Hi all,

Currently I have the following service:

@WebService
public interface CustomerService {
    Response updateCustomer(Customer c);
    Response addCustomer(Customer c);
}

The following is the part of generated WSDL:

<xs:complexType name="customer">
    <xs:sequence>
        <xs:element name="id" type="xs:long"/>
        <xs:element minOccurs="0" name="name" type="xs:string"/>
    </xs:sequence>
</xs:complexType>
<xs:complexType name="addCustomer">
    <xs:sequence>
        <xs:element minOccurs="0" name="customer" type="tns:customer"/>
    </xs:sequence>
</xs:complexType>
<xs:complexType name="updateCustomer">
    <xs:sequence>
        <xs:element minOccurs="0" name="customer" type="tns:customer"/>
    </xs:sequence>
</xs:complexType>
<wsdl:message name="addCustomer">
<wsdl:part element="tns:addCustomer" name="parameters">
    </wsdl:part>
</wsdl:message>
<wsdl:message name="updateCustomer">
<wsdl:part element="tns:updateCustomer" name="parameters">
    </wsdl:part>
</wsdl:message>
<wsdl:operation name="updateCustomer">
    <wsdl:input message="tns:updateCustomer" name="updateCustomer">
        </wsdl:input>
    <wsdl:output message="tns:updateCustomerResponse"
name="updateCustomerResponse">
        </wsdl:output>
</wsdl:operation>
<wsdl:operation name="addCustomer">
<wsdl:input message="tns:addCustomer" name="addCustomer">
    </wsdl:input>
        <wsdl:output message="tns:addCustomerResponse"
name="addCustomerResponse">
    </wsdl:output>
</wsdl:operation>

As you sawn, the operation updateCustomer & addCustomer use the same type
"customer", when I run the wsdl2java using this WSDL, the tool report the
following error:

WSDLToJava Error: Non unique body parts, operation [ updateCustomer ] and
operation [ addCustomer ] in binding  CustomerServiceImplServiceSoapBinding
have the same body block:  customer

I do nont want to change my service interface, how to handle this problem?
Although I tried to change the SOAPBinding with RPC, but the generated SOAP
message is not my expected, it was wrapped by the operation+response.

Thanks for your response,
William

Reply via email to