Hi, all!

I have a problem with wsdl2java not generating types for a particular
XSD to the correct package.

I have a WSDL that imports one XSD which in turn imports another XSD.
I would like the types from the second XSD go into a pre-determined
package. They however go into the default. Any hints on how to achieve
this customization?

Here is the setup I have. Directory layout goes like this:

src/main/
   jaxb/
       mobile-partner-schema-binding.xjb
       troubleticket-schema-binding.xjb
   xsd/
       assurance/
           partner/
              troubleticket.xsd
       mobile/
           partner/
              Mobile_v2.wsdl
              Mobile_v2.xsd

Mobile_v2.wsdl:
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions name="Mobile"
    targetNamespace="urn:mobile.ws.test"
    xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/";
    xmlns:tns="urn:mobile.ws.test"
    xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/";
    xmlns:xsd="http://www.w3.org/2001/XMLSchema";>

    <wsdl:types>
        <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema";>
            <xsd:import namespace="urn:mobile.ws.test"
schemaLocation="Mobile_v2.xsd" />
        </xsd:schema>
    </wsdl:types>

...
</wsdl:definitions>

Mobile_v2.xsd:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema";
           xmlns="urn:mobile.ws.test"
           xmlns:tns="urn:mobile.ws.test"
           xmlns:tt="urn:troubleticket.ws.test"
           targetNamespace="urn:mobile.ws.test"
           elementFormDefault="qualified">

    <xs:import namespace="urn:troubleticket.ws.test"
               schemaLocation="../../assurance/partner/troubleticket.xsd" />
...

</xs:schema>

troubleticket.xsd:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema";
           xmlns="urn:troubleticket.ws.test"
           targetNamespace="urn:troubleticket.ws.test"
           elementFormDefault="qualified">

    <xs:complexType name="TroubleTicket">
        <xs:annotation>
            <xs:documentation>Trouble ticket.</xs:documentation>
        </xs:annotation>
...
    </xs:complexType>

...

</xs:schema>


troubleticket-schema-binding.xjb:
<jxb:bindings version="1.0"
        xmlns:jxb="http://java.sun.com/xml/ns/jaxb";
        xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/";
        xmlns:xs="http://www.w3.org/2001/XMLSchema";>

        <jxb:bindings 
schemaLocation="../xsd/assurance/partner/troubleticket.xsd"
node="/xs:schema">
                <jxb:schemaBindings>
                        <jxb:package name="troubleticket.app.ws.partner.types"/>
                </jxb:schemaBindings>
        </jxb:bindings>

</jxb:bindings>

the pom config for the plugin is like so:

                              <wsdlOption>
                                    <wsdl>

${basedir}/src/main/xsd/mobile/partner/Mobile_v2.wsdl
                                    </wsdl>
                                    <extraargs>
                                        <extraarg>-validate</extraarg>
                                        <extraarg>-b</extraarg>
                                        <extraarg>

${basedir}/src/main/jaxb/mobile-partner-schema-binding.xjb
                                        </extraarg>
                                        <extraarg>-b</extraarg>
                                        <extraarg>

${basedir}/src/main/jaxws/troubleticket-definitions-binding.xjb
                                        </extraarg>
                                        <extraarg>-verbose</extraarg>
                                    </extraargs>
                                </wsdlOption>

Somehow, TroubleTicket type gets generated to the default package
test.ws.troubleticket instead of my expected package that I am trying
to bind to troubleticket.app.ws.partner.types

Any ideas on how I can force the CXF's hand on this and have the types
to generate into the package I want?

Thanks,
Alex.

Reply via email to