Herong's Tutorial Notes on Web Service and SOAP
Dr. Herong Yang, Version 3.00

RPC Response Messages

This section provides some examples of using RPC (Remote Procedure Call) response messages.

Examples of RPC responses:

Example 1 - A user needs to invoke the following RPC on a target system called "inventory":

   getQuantityInStock(PartNumber="123")

This RPC can be invoked as a Web method. The target system will retrieve the current quantity number and send it back in a SOAP RPC response message:

<?xml version="1.0"?>
<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope">
 <env:Body 
    env:encodingStyle="http://www.w3.org/2003/05/soap-encoding"
    xmlns:enc="http://www.w3.org/2003/05/soap-encoding">
  <res:response enc:nodeType="struct" xmlns:res="http://www.yang.com">
   <res:result>208</res:result>
  </res:response>
 </env:Body>
</env:Envelope>

Example 2 - Another user needs to invoke the following RPC on a target system called "inventory":

   updateQuantityInStock(PartNumber="123", NewQuantity="200")

This RPC can be invoked as a Web method. The target system will update the quantity and send a SOAP RPC response message back. The target system may decide to include the updated quantity as the return value, and the previous value as an output parameter:

<?xml version="1.0"?>
<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope">
 <env:Body 
    env:encodingStyle="http://www.w3.org/2003/05/soap-encoding"
    xmlns:enc="http://www.w3.org/2003/05/soap-encoding">
  <res:response enc:nodeType="struct" xmlns:res="http://www.yang.com">
   <res:result>200</res:result>
   <res:previousQuantity>208</res:previousQuantity>
  </res:response>
 </env:Body>
</env:Envelope>

Example 3 - A user wants to update prices of a list of part numbers in an inventory system with the following RPC:

   updatePrice(List=ArrayOfStructures)

This RPC can be invoked with a SOAP RPC invocation message. The target system will update prices based on the list received as an input parameter and send a SOAP RPC response message. The target system may decide to include the number of prices that have been updated as the return value:

<?xml version="1.0"?>
<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope">
 <env:Body 
    env:encodingStyle="http://www.w3.org/2003/05/soap-encoding"
    xmlns:enc="http://www.w3.org/2003/05/soap-encoding">
  <res:response enc:nodeType="struct" xmlns:res="http://www.yang.com">
   <res:result>2</res:result>
  </res:response>
 </env:Body>
</env:Envelope>

Sections in This Chapter

What is SOAP RPC Presentation?

Using Web Methods to Invoke RPC

Using SOAP Messages to Invoke RPC

RPC Response Messages

Dr. Herong Yang, updated in 2007
RPC Response Messages