Reputation: 2841
I'm trying to figure out how WS SOAP server knows what operation to execute when receiving a SOAP. So, can someone pls clarify the following?
There are number of examples on the web that have something like this:
<wsdl:operation name="function1">
<wsdl:input message="function1Request"/>
<wsdl:output message="function1Response"/>
<wsdl:fault message="someFault"/>
</wsdl:operation>
<wsdl:operation name="function2">
<wsdl:input message="function2Request"/>
<wsdl:output message="function2Response"/>
<wsdl:fault message="someFault"/>
</wsdl:operation>
and then SOAP request for calling the function1 looks like this:
<SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Body>
<m:function1Request xmlns:m="http://namespaces.com">
...
</m:function1Request>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
So, the operation itself is not sent in the SOAP. It contains just the payload of the request. Then, I presume, the server has to match the request type with the operation definitions from the WSDL in order to find out which operation is actually required to be called.
Ok, this works in case of 1 to 1 relation between the operation and the input parameter type.
But, what if I have 2 operations with the same input type? Something like this:
<wsdl:operation name="function1">
<wsdl:input message="function1Request"/>
<wsdl:output message="function1Response"/>
<wsdl:fault message="someFault"/>
</wsdl:operation>
<wsdl:operation name="function2">
<wsdl:input message="function1Request"/>
<wsdl:output message="function2Response"/>
<wsdl:fault message="someFault"/>
</wsdl:operation>
How will the server know which operation to execute?
Upvotes: 2
Views: 6935
Reputation: 2841
It's described in the binding section of the WSDL. There are several ways of letting server know which operation to call. You can specify binding based on the header section of the SOAP for example. In this particular case however, the binding will be made based on the soap body type.
I think that having duplicate input definitions will be considered as invalid.
Here are links with more info:
https://msdn.microsoft.com/en-us/library/ms996486.aspx
https://www.w3.org/TR/wsdl#_bindings
Upvotes: 3