Loading...

Difference among RPC and Document Style - WebServices WSDL

RPC and document style in WSDL are the two most widely used terms in reference to Web services and SOAP protocol.
Diff b/w RPC & Document Style


Performance wise there is no variation at all. And   below are the differences RPC and document style

In document style, the SOAP message is send as a single document whereas in the RPC style, the SOAP body may contain several elements.
The document style is freely coupled whereas the RPC is strongly coupled.
In the document style, the client sends the service parameters in simple XML format whereas in the RPC style the parameters are sent as discrete of values.
The Document/Literal style loses the operation name in the SOAP message whereas the RPC/literal style keeps the operation name in the SOAP message.
In the Document/Literal style, messages can always be validated using any XML validator whereas in the RPC/literal style, the transferred data is difficult to validate by the SOAP message.
If we take the real WSDL for both of them and import it in the SOAP UI then we will find the variation below

Document style
 
<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:sch="http://www.tibco.com/schemas/webservice/Schema.xsd">
   <soapenv:Header/>
   <soapenv:Body>
      <sch:OrderRequest>
         <sch:Name>?</sch:Name>
         <sch:Price>?</sch:Price>
      </sch:OrderRequest>
   </soapenv:Body>
</soapenv:Envelope>
 
RPC Style
 
<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:inp="http://InputMessageNamespace" xmlns:sch="http://www.tibco.com/schemas/webservice/Schema.xsd">
   <soapenv:Header/>
   <soapenv:Body>
      <inp:BookOrder>
         <sch:OrderRequest>
            <sch:Name>?</sch:Name>
            <sch:Price>?</sch:Price>
         </sch:OrderRequest>
      </inp:BookOrder>
   </soapenv:Body>
</soapenv:Envelope>
 
Here Book Order is the operation name.  In RPC style as we can see after the Soap body comes the operation name and then the inputs. In document style just after the Soap body comes the inputs.
 
The use attribute also helps to distinguish between RPC and document styles.
The use attribute describes how both the styles are represented in XML. The use attribute describes whether the message parts are encoded or the message follows an XML schema definition.
Based on choices, there are four possible combinations of both RPC and document styles; viz RPC/encoded, RPC literal, Document/Encoded or Document/Literal.

 Not all of the four combinations are in use, and the preference of one combination over the other is more of a personal interest.

The main difference between document and RPC styles is that, in the document style, the client always sends the service parameters to the server in a simple XML document format rather than a discrete set of parameter values. The document style is loosely coupled as compared to the RPC style.

In the Document/Literal style, the message can always be validated using any XML validator. The content within the SOAP body is clearly defined in the schema.

In the RPC/literal style, the transferred data is difficult to validate by the SOAP message.The Document/Literal style loses the operation name in the SOAP message whereas in the RPC/literal style the operation name still exists in the SOAP message.

Out of four different combinations, the styles that are widely used are RPC/literal and Document/Literal.
WebServices WSDL 4750405842432725341

Post a Comment Default Comments

Home item

Blog Archive

Popular Posts

Random Posts

Flickr Photo