As mentioned earlier in this section, an RPC call is
blocked during the waiting periods. Once a procedure is
executed and the response is sent from the server and
received on the client, the execution of the procedure
continues. (This means that RPC calls are typically
synchronous. There are also asynchronous RPC calls, but
the focus of this section is on synchronous RPC calls.)
Now that the high-level communications of RPC have
been covered, let’s look at an example of an RPC request
message. There are different versions of RPC messages.
However, the most common is XML-RPC; XML-RPC was
also the most common version prior to SOAP becoming
available. Example 6-6 shows a simple RPC call with
XML-RPC that uses a GET to retrieve the name of the
21st state added to the United States.
Example 6-6 Sample XML-RPC Request Message
Click here to view code image
<?xml version="1.0"?>
<methodCall>
<methodName>examples.getStateName</methodName>
<params>
<param>
<value><i4>21</i4></value>
</param>
</params>
</methodCall>
You can see in Example 6-6 that the format of XML is
very similar to that of SOAP, making these messages
simple for humans to read and digest and also to build.
Example 6-7 shows an example of an XML-RPC reply or
response message, in which the response to the GET
message from Example 6-6 is Illinois.
Example 6-7 Sample XML-RPC Reply Message
Click here to view code image