RPC vs Document style

Friday, March 23, 2007

RPC Style

RPC stands for Remote Procedure call, in which the client sends a SOAP request to execute an operation on the Web Service. The SOAP request contains the name of method to be executed and the parameter it takes. The server running the Web Service converts this request to appropriate objects, executes the operation and sends the response as SOAP message to client. At the client side, this response is used to form appropriate objects and return the required information (output) to the client. RPC-style Web Services are tightly coupled because the sending parameters and return values are as described in WSDL (Web Service Description Language ) file and are wrapped in the SOAP body. Following is an example SOAP Body of RPC-style Web Service, which invokes GetStockQuote method with input parameter "ORCL".

<SOAP-ENV:Envelope...>
    <SOAP-ENV:Body>
      <m:GetStockQuote xmlns:m="urn:xmethods:example">
        <m:Symbol>ORCL</m:Symbol>
      </m:GetStockQuote>
    </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

Document-style

Document Style Web Service are loosely coupled and the request / response are in the form of XML documents. The client sends the parameter to the Web Service as XML document, instead of discrete set of parameter values. The Web Service processes the document, executes the operation and constructs & sends the response to the client as an XML document . There is no direct mapping between the server objects (parameters, method calls etc) and the values in XML documents. The application has to take care of mapping the XML data values. The SOAP Body of a document style carries one or more XML documents, within its body. The protocol places no constraint on how that document needs to be structured, which is totally handled at the application level. Document-style Web Service follows asynchronous processing. Following is an example SOAP body for Document style Web Service.

<SOAP-ENV:Envelope ...>
    <SOAP-ENV:Body>
       <StockQuoteRequest symbol="ORCL"/>
    </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

  © Blogger templates Newspaper by Ourblogtemplates.com 2008

Back to TOP