Freigeben über


Web Services Quiz: Issue 7 - the Answer

The answer to Issue 7 is the following:

<wsdl:binding name="CalculatorSoap" type="tns:CalculatorPortType">

   <soap:binding style="rpc" transport="https://schemas.xmlsoap.org/soap/http"/>

   <wsdl:operation name="Add">

   <soap:operation soapAction="uri.test.com/add"/>

   <wsdl:input>

   <soap:body parts="AddRequest" use="literal"/>

   </wsdl:input>

   <wsdl:output>

   <soap:body parts="AddResponse" use="literal"/>

   </wsdl:output>

   </wsdl:operation>

</wsdl:binding>

Please note that the soap binding is rpc-literal and not document/literal.

Here is the explanation why:

Because the provided WSDL messages AddRequestMsg and AddResponseMsg are referenced as types (instead as elements), only rpc bindings are possible.

   <wsdl:message name="AddRequestMsg">

      <wsdl:part name="AddRequest" type="tns:AddRequestType" />

   </wsdl:message>

   <wsdl:message name="AddResponseMsg">

      <wsdl:part name="AddResponse" type="tns:AddResponseType" />

   </wsdl:message>

But let’s look at the corresponding WS-I BP 1.0 rules:

R2203An rpc-literal binding in a DESCRIPTION MUST refer, in its soapbind:body element(s), only to wsdl:part element(s) that have been defined using the type attribute.

R2204A document-literal binding in a DESCRIPTION MUST refer, in each of its soapbind:body element(s), only to wsdl:part element(s) that have been defined using the element attribute.

Because the provided messages use the type attribute to define their parts, we have to define an rpc-literal binding to be compliant with the WS-I BP 1.0.

This leads me straight to Issue 8 – Dealing with rpc-literal in a.NET environment.