Difference between 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.

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

  1. In document style, the SOAP message is sent as a single document whereas in the RPC style, the SOAP body may contain several elements.
  2. The document style is loosely coupled whereas the RPC is tightly coupled.
  3. 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.
  4. 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.
  5. 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.
  6. If we take the concrete WSDL for both of them and import it in the SOAP UI  then we will find the difference below
 Document style
 
   <soapenv:Header/>
   <soapenv:Body>
      <sch:OrderRequest>
         <sch:Name>?</sch:Name>
         <sch:Price>?</sch:Price>
      </sch:OrderRequest>
   </soapenv:Body>
</soapenv:Envelope>
 
RPC Style
 
   <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 BookOrder 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.

  

  © Blogger templates The Professional Template by Ourblogtemplates.com 2008

Back to TOP