Onuray Sahin
Onuray Sahin

Reputation: 4135

Generating classes from WSDL: Duplicate operation with name error

I am trying to generate Java classes using Eclipse (New Web Service Client).

Eclipse throws this exception:

Error in generating Java from WSDL: java.lang.IllegalArgumentException: Duplicate operation with name=OpName, found in portType '{http://tempuri.org/}MyServiceSoap'.

In WSDL:

<wsdl:operation name="OpName"> <wsdl:input message="tns:tnsIn"/> <wsdl:output message="tns:tnsOut"/> </wsdl:operation>

<wsdl:operation name="OpName"> <wsdl:input name="name" message="tns:tnsIn"/><wsdl:output name="name" message="tns:tnsOut"/></wsdl:operation>

How can I solve this issue? Could you suggest any other tools or development environments to generate classes according to WSDL?

Upvotes: 2

Views: 6545

Answers (2)

Santosh
Santosh

Reputation: 17893

This is the case of Operation Overloading. This was only supported in WSDL1.1 specification. As per the new WSDL1.2 Specs, Operation Overloading is not allowed. You will have to change the name of the operation.

Check out this link

To quote from this link.

It is important to note here that overloaded operations are supported in WSDL 1.1 (see the links in the "Resources" section below),but have been removed from the draft specification for WSDL 1.2. The committee developing the new draft has decided that overloading should not be present. The reasons and opinions for this decision are outside the scope of this article, but there are reference notes regarding it in the current working draft for WSDL 1.2

So just to make it work, change the name of the operation or if you are generating a client, check if the eclipse provides some option to select the WSDL version.

Upvotes: 5

Pedantic
Pedantic

Reputation: 5022

Get rid of the second OpName operation in the wsdl perhaps?

Upvotes: 0

Related Questions