简体   繁体   中英

CXF wsdl2java - mapping namespaces and packages

I'm using CXF's wsdl2java tool to create a java web service. I have a wsdl file and a few XSD files and I know that it's possible to use a binding file to map namespaces and packages. My binding file looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<jaxb:bindings xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema" jaxb:version="2.0">
    <jaxb:bindings schemaLocation="SchemeA.xsd" node="/xsd:schema">
        <jaxb:schemaBindings>
            <jaxb:package name="com.test.package.a" />
        </jaxb:schemaBindings>
    </jaxb:bindings>
    <jaxb:bindings schemaLocation="SchemeB.xsd" node="/xsd:schema">
        <jaxb:schemaBindings>
            <jaxb:package name="com.test.package.b" />
        </jaxb:schemaBindings>
    </jaxb:bindings>
    <jaxb:bindings schemaLocation="SchemeC.xsd" node="/xsd:schema">
        <jaxb:schemaBindings>
            <jaxb:package name="com.test.package.c" />
        </jaxb:schemaBindings>
    </jaxb:bindings>
</jaxb:bindings>

My files:

  • A.wsdl (imports all .xsd files)
  • SchemeA.xsd
  • SchemeB.xsd
  • SchemeC.xsd

It works great for everything in this XSD schemes but not for wsdl's definition. I mean at the end my packages looks like this:

  • com.test.package.a
  • com.test.package.b
  • com.test.package.c
  • https.package_test_com.a.service

The last line bother me, and I would like it to look like this: com.test.package.a.service

绑定文件由jaxb使用,该文件管理参数和响应的绑定,但是webservice由cxf或jax-ws直接管理,因此您需要使用wsdl2java的-p选项指定此绑定,如http://cxf.apache所示。 org / docs / wsdl-to-java.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM