Freigeben über


What is rpc-literal anyway?

Although it’s a longtime ago, I want to follow up with the promised explanations for Issue 8:

Prolog: WS BP 1.0 prohibits the usage of rpc-encoded but explicitly allows rpc-literal. But what is rpc-literal anyway?

Rpc stands for remote procedure call. If you want to apply this technology in loosely coupled environments, you’ll get a problem: The caller must know the exact signature and method name of the target implementation; otherwise it won’t be able to call it. Although this is definitely not what we’re looking for within a Web Service enabled environment, nobody prevents you from doing so:

 

Rpc-literal Web Services use the rpc style of message assembling but support the literal way of describing the types that are passed by a procedure: In this case, literal means that there exists a schema for every parameter type but not for the message body itself. The message body gets constructed based on some simple rules:

  • The procedure (or method) name defines the name of the message
  • The different part names within <wsdl:message> are used for the argument names

Let’s have a look at the four different artifacts, the CLR signature, the wsdl message, the binding and the soap message:

A typical rpc signature for an addition request looks the following (note, there is no message):

   int Add (int a, int b)

The corresponding wsdl message is named after its method and adds a part for each argument:

   <message name=“Add”>
<part name=“a” type=“xsd:int”>
<part name=“b” type=“xsd:int”>

</message>

Within the wsdl bindings, the style is set to rpc and the soap body namespace must be defined (the namespace will be used for the top-level message elements):

   <wsdl:binding name=“…" type="tns:…">

   <soap:binding style=“rpc“ …>

   <wsdl:operation name=“Add">

      <wsdl:input name=“Add">

        <soap:body namespace="operationNS" use="literal"/>

      </wsdl:input>

   </wsdl:operation>

   </wsdl:binding>

The soap message gets assembled by using the operation name and the corresponding message parts:

  <soap:body>
<x:Add xmlns:x=“operationNS”>
<a>200</a>
<b>400</b>
</x:Add>

</soap:body>

The next post in this answer series is going to discuss how you can consume rpc-literal Web Services using .NET. Stay tuned…

Comments