Hi All,
I just encountered this problem while trying to use the same message as
input for 2 different operations:
WSDLToJava Error: Non unique body parts, operation [ GetImageFileName ] and
operation [ GetImageFormat ] in binding
{http://theSoftwareArchive.com}SoftwareArchiveBinding have the same body
block: {http://theSoftwareArchive.com}imageID
the relevant part of the wsdl is below:
<wsdl:types>
<xs:schema xmlns:tns="http://theSoftwareArchive.com"
targetNamespace="http://theSoftwareArchive.com">
<xs:element name="imageID" type="xs:integer"/>
<xs:element name="imageFileName" type="xs:string"/>
<xs:element name="imageFormat" type="xs:string"/>
</xs:schema>
</wsdl:types>
<wsdl:message name="imageIDMessage">
<wsdl:part name="parameters" element="tns:imageID"/>
</wsdl:message>
<wsdl:message name="imageFileNameMessage">
<wsdl:part name="parameters" element="tns:imageFileName"/>
</wsdl:message>
<wsdl:message name="imageFormatMessage">
<wsdl:part name="parameters" element="tns:imageFormat"/>
</wsdl:message>
<wsdl:portType name="SoftwareArchivePortType">
<wsdl:operation name="GetImageFileName">
<wsdl:input message="tns:imageIDMessage"/>
<wsdl:output message="tns:imageFileNameMessage"/>
</wsdl:operation>
<wsdl:operation name="GetImageFormat">
<wsdl:input message="tns:imageIDMessage"/>
<wsdl:output message="tns:imageFormatMessage"/>
</wsdl:operation>
</wsdl:portType>
Now, I thought this may be because I use the same message imageIDmessage for
both operations GetImageFileName and GetImageFormat, so I created a 2nd
message which uses the same element like so:
<wsdl:message name="imageIDMessage">
<wsdl:part name="parameters" element="tns:imageID"/>
</wsdl:message>
<wsdl:message name="imageIDMessage_2">
<wsdl:part name="parameters" element="tns:imageID"/>
</wsdl:message>
and use them like that:
<wsdl:portType name="SoftwareArchivePortType">
<wsdl:operation name="GetImageFileName">
<wsdl:input message="tns:imageIDMessage"/>
<wsdl:output message="tns:imageFileNameMessage"/>
</wsdl:operation>
<wsdl:operation name="GetImageFormat">
<wsdl:input message="tns:imageIDMessage_2"/>
<wsdl:output message="tns:imageFormatMessage"/>
</wsdl:operation>
</wsdl:portType
but this leads to the same error message. Actually, from the error message
the problem seems to come from the fact they both use the same imageID
element.
Googling a bit on that, I found this (on this forum actually):
http://old.nabble.com/WSDLToJava-Error-%3A-Non-unique-body-parts!-In-a-port%2C-operations-must-have-unique-operation-signaure-ts17760468.html#a17760644
where someone has a similar issue.
The 2 replies seem to suggest that this is not possible for some reason
(which I didn't really understand actually) and one reply suggested making a
complexType out of the simple element and create 2 simple elements based on
that complex type. This way, there are actually 2 different elements. I
tried that and it works, but it sounds like a hack to me... why is not
possible to use the same message or element as input for 2 different
operations ??
Even more confusing, when I add a second element (called bla as an example)
to the message, e.g.:
<wsdl:types>
<xs:schema xmlns:tns="http://theSoftwareArchive.com"
targetNamespace="http://theSoftwareArchive.com">
<xs:element name="imageID" type="xs:integer"/>
<xs:element name="bla" type="xs:integer"/>
<xs:element name="imageFileName" type="xs:string"/>
<xs:element name="imageFormat" type="xs:string"/>
</xs:schema>
</wsdl:types>
<wsdl:message name="imageIDMessage">
<wsdl:part name="parameters1" element="tns:imageID"/>
<wsdl:part name="parameters2" element="tns:bla"/>
</wsdl:message>
Then it works (?????) even if the 2 operations GetImageFileName and
GetImageFormat uses the same message imageIDMessage which is made of the
same input parameters (only difference, there is now 2 parameters instead of
one)
Is this a bug, or am I missing something here ?
Cheers
David
--
View this message in context:
http://old.nabble.com/%22Non-unique-body-parts%22-error-when-trying-to-use-same-input-message-for-2-different-operations-tp28387764p28387764.html
Sent from the cxf-user mailing list archive at Nabble.com.