Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error while generating client from wsdl using apache cxf

Tags:

java

wsdl

cxf

I have tried to generate stubs and client from a wsdl using cxf(versions 2.2.3, 2.2.6 and 2.7.0) by giving the below command

> wsdl2java.bat -p com.easynet.eordering.client -client  http://expediter.staging.gis.easynet.com:7001/cds/services/eordering?wsdl

but I am getting an error as

WSDLToJava Error: Non unique body parts! In a port, operations must have unique operation signaure on the wire for successful dispatch. In port {http://eordering.uk.easynet.net}eorderingPortSOAP, Operations "{http://eordering.uk.easynet.net}getAMList" and "{http://eordering.uk.easynet.net}getDCList" have the same request body block {http://eordering.uk.easynet.net}userListRequest

I know why this error was thrown, in my wsdl operations are written as

<operation name="getDCList"><input message="tns:userListRequest"/><output message="tns:userListResponse"/></operation>
<operation name="getAMList"><input message="tns:userListRequest"/><output message="tns:userListResponse"/></operation>

I was just reusing the userListRequest parameter for both the operations, I believe the error was thrown as the same parameter(userListRequest) is specified in both the operations.

Is there any way to avoid this error without making changes to the wsdl ? (as I know operation overloading is not allowed from wsdl 1.2 but input parameters overloading ? ).

like image 594
Techie Avatar asked Oct 23 '12 11:10

Techie


2 Answers

As mentioned in the question:

Is there any way to avoid this error without making changes to the wsdl ?

If you can't fix the WSDL, you can disable its validation:

-validate=none

or if you are using Maven:

<configuration>
    <wsdlOptions>
        <wsdlOption>
            <wsdl>${basedir}/src/main/wsdl/my.wsdl</wsdl>
            <validate>none</validate>
        </wsdlOption>
    </wsdlOptions>
</configuration>

Not sure if this is not going to cause problems at runtime. I will find this soon and will update this post.

like image 183
Constantino Cronemberger Avatar answered Sep 16 '22 15:09

Constantino Cronemberger


Such a WSDL would not be WSI-BasicProfile compliant. See:

http://www.ws-i.org/profiles/basicprofile-1.1.html#Operation_Signatures

The profile defines the operation signature as the name of the element that would appear in the soap:Body. Thus, if two operations use the same child element (or message in your case), they are considered non-unique and violating:

R2710 The operations in a wsdl:binding in a DESCRIPTION MUST result in operation signatures that are different from one another.
like image 34
Daniel Kulp Avatar answered Sep 19 '22 15:09

Daniel Kulp