Hello,

I am trying to do something that seems like it should be pretty 
straightforward, but when I generate code using wsdl2java, I end up with 
multiple versions of the same classes.  Using the example WSDL below, I end up 
with both a GetClientInfo.java and a GetClientInfo_type0.java class that are 
identical.  I am assuming this is because in the GetClientInfoFull element, I 
am including a reference to the GetClientInfo element.  I cannot modify the 
declaration of the GetClientInfo element because in my actual situation that is 
defined in a schema that I do not own.  I am trying to create a "wrapper" 
element that contains both information that our system requires and the element 
defined by the other schema.

I just want one GetClientInfo class. . . is there a wsdl2java option that I am 
missing that will prevent the creation of this extra "_type0" class?  I am 
using Axis2 v1.5.3.

<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions name="Sample"
                  targetNamespace="http://www.test.com/services";
                  xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/";
                  xmlns:xs="http://www.w3.org/2001/XMLSchema";
                  xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/";
                  xmlns:tns="http://www.test.com/services";
                  xmlns:ns1="http://www.test.com/xsd";
                  xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl";
                  xmlns="http://schemas.xmlsoap.org/wsdl/";>
    <wsdl:types>
        <xs:schema attributeFormDefault="qualified" 
elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema"; 
xmlns="http://www.test.com/xsd"; targetNamespace="http://www.test.com/xsd";>
            <xs:element name="GetClientInfoFull">
                <xs:complexType>
                    <xs:sequence>
                        <xs:element name="header" type="xs:string"/>
                        <xs:element ref="GetClientInfo"/>
                    </xs:sequence>
                </xs:complexType>
            </xs:element>
            <xs:element name="GetClientInfoFullResponse">
                <xs:complexType>
                    <xs:sequence>
                        <xs:element name="header" type="xs:string"/>
                        <xs:element ref="GetClientInfoResponse"/>
                    </xs:sequence>
                </xs:complexType>
            </xs:element>
            <xs:element name="ServiceFault">
                <xs:complexType>
                    <xs:sequence>
                        <xs:element name="localErrorCode" type="xs:string"/>
                        <xs:element name="localErrorDescription" 
type="xs:string"/>
                    </xs:sequence>
                </xs:complexType>
            </xs:element>


            <xs:element name="GetClientInfo">
                <xs:complexType>
                    <xs:sequence>
                        <xs:element minOccurs="0" name="ClientAcctNbr" 
type="xs:string"/>
                    </xs:sequence>
                </xs:complexType>
            </xs:element>
            <xs:element name="GetClientInfoResponse">
                <xs:complexType>
                    <xs:sequence>
                        <xs:element minOccurs="0" name="GetClientInfoResult" 
type="xs:string"/>
                    </xs:sequence>
                </xs:complexType>
            </xs:element>

        </xs:schema>
    </wsdl:types>

    <wsdl:message name="getClientInfoRequest">
        <wsdl:part name="parameters" element="ns1:GetClientInfoFull"/>
    </wsdl:message>
    <wsdl:message name="getClientInfoResponse">
        <wsdl:part name="parameters" element="ns1:GetClientInfoFullResponse"/>
    </wsdl:message>
    <wsdl:message name="serviceFault">
        <wsdl:part name="parameters" element="ns1:ServiceFault"/>
    </wsdl:message>

    <wsdl:portType name="TestPortType">
        <wsdl:operation name="getClientInfo">
            <wsdl:input name="GetClientInfoRequest" 
message="tns:getClientInfoRequest" wsaw:Action="urn:getClientInfo"/>
            <wsdl:output name="GetClientInfoResponse" 
message="tns:getClientInfoResponse" wsaw:Action="urn:getClientInfoResponse"/>
            <wsdl:fault name="ServiceFault" message="tns:serviceFault" 
wsaw:Action="urn:serviceFault"/>
        </wsdl:operation>
    </wsdl:portType>

    <wsdl:binding name="TestServicesSOAP" type="tns:TestPortType">
        <soap:binding style="document" 
transport="http://schemas.xmlsoap.org/soap/http"/>
        <wsdl:operation name="getClientInfo">
            <soap:operation soapAction="urn:getClientInfo" style="document"/>
            <wsdl:input name="GetClientInfoRequest">
                <soap:body use="literal"/>
            </wsdl:input>
            <wsdl:output name="GetClientInfoResponse">
                <soap:body use="literal"/>
            </wsdl:output>
            <wsdl:fault name="ServiceFault">
                <soap:fault name="ServiceFault" use="literal"/>
            </wsdl:fault>
        </wsdl:operation>
    </wsdl:binding>

    <wsdl:service name="TestServices">
        <wsdl:port name="TestServicesSOAP" binding="tns:TestServicesSOAP">
            <soap:address location="http://localhost/services/TestServices"/>
        </wsdl:port>
    </wsdl:service>

</wsdl:definitions>

Thanks,
Wally

Reply via email to