Download
Cover
Contents
Milestone One
Milestone Two
Milestone Three
Appendix
Diary
Biblography
Code Samples
background image
Previous
04029437
m1.26
2.6.1.1 XML-RPC
XML-RPC defines a very specific way in which the request parameters and the response
data must be formed. This is mainly to enable the use of data types in the XML structure.
For this to work effectively XML-RPC requests must use the POST method.
This table describes the simple data types supported by XML-RPC:
Data Type
Description
Example
Base64
Binary Data, Base64 encoded
<base64>ZGVjb2RlIG1l</base64>
Boolean
True or false,
1
=
true
,
0
=
false
<boolean>1</boolean>
Date-Time
ISO 8601 Date-Time,
YYYYMMDDTHH:MM:SS
<datetime.iso8601>17911226T00:00
</datetime.iso8601>
Double
Floating point number
<double>99.99</double>
Integer/i4
Whole number
<int>666</int>
<i4>666</i4>
String
Alphanumeric data
<string>Alphanumeric Data<string>
In addition to these types, XML-RPC supports two compound types,
array
and
struct
.
These are described as compound types because they allow multiple values within
themselves, each of which can be a simple or complex type.
The example below describes how an
array
value is constructed:
<array>
<data>
<value><string>Some Value</string></value>
<value><int>666</int></value>
<value><double>99.99</double></value>
</data>
</array>
It is important to note that the order in which the
value
elements appear defines the
order in which they are held in the array. In the above example
Some Value
is at index
0
,
666
at index
1
, and
99.99
at index
2
.
A
struct
is similar to an array, except it names the values, therefore in a
struct
the
order is not important. The example below shows an equivalent
struct
value:
<struct>
<data>
<member>
<name>MyString</name>
<value><string>Some Value</string></value>
</member>
<member>
<name>MyInteger</name>
<value><int>666</int></value>
</member>
<member>
<name>MyDouble</name>
<value><double>99.99</double></value>
</member>
</data>
</struct>
XML-RPC uses a common mechanism to invoke remote procedures. Imagine we have a
remote server that implements a procedure
md5
, assuming this method accepts a single
string parameter a call to invoke this method may look like this:
Navigation