XML - Managing Data Exchange/RPC

Author: Nathan Slider Editor: Nathan Slider UGA Master of Internet Technology Program, 2005

Learning Objectives
Upon completion of this chapter, you will be able to
 * Discuss XML-RPC
 * Create XML-RPC Code based on Examples

RPC Defined
In order to fully understand XML-RPC, we should fist define RPC. A Remote Procedure Call (RPC) is a protocol that allows a computer program running on one host to cause code to be executed on another host without the programmer needing to explicitly code for this. An RPC is initiated by the caller (client) sending a request message to a remote system (the server) to execute a certain procedure using arguments supplied. A result message is returned to the caller. There are many variations and subtleties in various implementations, resulting in a variety of different (incompatible) RPC protocols.

In order to allow servers to be accessed by differing clients, a number of standardized RPC systems have been created. Most of these use an Interface Description Language (IDL) to allow various platforms to call the RPC. Web services were the first real attempt to implement RPC between platforms. Using Web services a .NET client can call a remote procedure implemented in Java on a Unix server (and vice versa).

Web services use XML as the IDL, and HTTP as the network protocol. The advantage of this system is simplicity and standardization, the IDL is a text file that is widely understood, and HTTP is built into almost all modern operating systems. An example of such an RPC system is XML-RPC.

XML-RPC Defined
XML-RPC (Extensible Markup Language Remote Procedure Call) is a Remote Procedure Call protocol encoded in XML. It is a very simple protocol, defining only a handful of data types and commands, and the entire description can be printed on two pages of paper. This is in stark contrast to most RPC systems, where the standards documents often run into the thousands of pages and require considerable software support in order to be used.

It was first created by in 1995 with. However, Microsoft considered it too simple and started adding functionality. After several rounds of this, the standard was no longer so simple and became what is now.

"We wanted a clean, extensible format that's very simple. It should be possible for an HTML coder to be able to look at a file containing an XML-RPC procedure call, understand what it's doing, and be able to modify it and have it work on the first or second try... We also wanted it to be an easy to implement protocol that could quickly be adapted to run in other environments or on other operating systems." -xmlrpc.com

Data Types
Data Types Referenced from

Examples
An example of a typical XML-RPC request would be:

An example of a typical XML-RPC response would be:

A typical XML-RPC fault would be:

A final example, comparing a PHP associative array with an equivalent XML-RPC. This array:

Becomes the following XML-RPC:

