Herong's Tutorial Notes on Perl - Part B
Dr. Herong Yang, Version 4.11

XML-RPC Protocol

Part:   1   2 

This chapter describes:

  • What is XML-RPC?
  • XML-RPC specifications.

For more information XSD and XML, see my other book: "Herong's notes on XML Technologies" at http://www.geocities.com/herong_yang/xml.

What is XML-RPC?

Here is the definition of XML-RPC from the XML-RPC home page at http://www.xmlrpc.com:

"It's a spec and a set of implementations that allow software running on disparate operating systems, running in different environments to make procedure calls over the Internet."

"It's remote procedure calling using HTTP as the transport and XML as the encoding. XML-RPC is designed to be as simple as possible, while allowing complex data structures to be transmitted, processed and returned."

My understanding of XML-RPC is that it is specification of how to:

  • Define a method call in XML.
  • Send a method call over Internet with as a HTTP request.
  • Define returning values of a method call in XML.
  • Receive returning values as a HTTP response.

RPC stands for remote procedure call.

XML-RPC Specifications

1. Defining a method call in XML. XML-RPC defines a method call as an XML element called "methodCall". I have tried to find a copy of the official XML Schema Definition (XSD) of "methodCall". But I had no success. So I wrote one myself. It is definitely not 100% accurate. But it does show you how the "methodCall" XML structure should be.

<?xml version="1.0"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<!-- xmlRpcMethodCall.xsd
     Copyright (c) 2005 by Dr. Herong Yang
-->
 <xsd:element name="methodCall" type="methodCallType"/>
 <xsd:complexType name="methodCallType">
  <xsd:sequence>
   <xsd:element name="methodName" type="xsd:string" 
      minOccurs="1" maxOccurs="1"/>
   <xsd:element name="params" type="paramsType" 
      minOccurs="0"/>
  </xsd:sequence>
 </xsd:complexType>
 <xsd:complexType name="paramsType">
  <xsd:sequence>
   <xsd:element name="param" type="paramType" 
      minOccurs="1"/>
  </xsd:sequence>
 </xsd:complexType>
 <xsd:complexType name="paramType">
  <xsd:sequence>
   <xsd:element name="value" type="valueType" 
      minOccurs="1" maxOccurs="1"/>
  </xsd:sequence>
 </xsd:complexType>
 <xsd:complexType name="valueType">
  <xsd:choice>
   <xsd:element name="int" type="xsd:int" />
   <xsd:element name="boolean" type="xsd:boolean" />
   <xsd:element name="string" type="xsd:string" />
   <xsd:element name="double" type="xsd:double" />
   <xsd:element name="dateTime.iso8601" type="xsd:string" />
   <xsd:element name="base64" type="xsd:xsd:base64Binary" />
   <xsd:element name="struct" type="structType" />
   <xsd:element name="array" type="arrayType" />
  </xsd:choice>
 </xsd:complexType>
 <xsd:complexType name="structType">
  <xsd:sequence>
   <xsd:element name="member" type="memberType"
      minOccurs="1"/>
  </xsd:sequence>
 </xsd:complexType>
 <xsd:complexType name="memberType">
  <xsd:sequence>
   <xsd:element name="name" type="xsd:string"
      minOccurs="1" maxOccurs="1"/>
   <xsd:element name="value" type="valueType"
      minOccurs="1" maxOccurs="1"/>
  </xsd:sequence>
 </xsd:complexType>
 <xsd:complexType name="arrayType">
  <xsd:sequence>
   <xsd:element name="data" type="dataType"
      minOccurs="1" maxOccurs="1"/>
  </xsd:sequence>
 </xsd:complexType>
 <xsd:complexType name="dataType">
  <xsd:sequence>
   <xsd:element name="value" type="valueType"
      minOccurs="0"/>
  </xsd:sequence>
 </xsd:complexType>
</xsd:schema>

(Continued on next part...)

Part:   1   2 

Dr. Herong Yang, updated in 2006
Herong's Tutorial Notes on Perl - Part B - XML-RPC Protocol