XML-RPC Data Model
The XML-RPC specification defines six basic data types and two compound data types that represent combinations of types. While this is a much more restricted set of types than many programming languages provide, it’s enough to represent many kinds of information, and it seems to have hit the lowest common denominator for many kinds of program-to-program communications.
All of the basic types are represented by simple XML elements whose
content provides the value. For example, to define a
string
whose value is “Hello
World!”, you’d write:
<string>Hello World!</string>
The basic types for XML-RPC are listed in Table 2-1.
Type |
Value |
Examples |
|
32-bit integers between -2,147,483,648 and 2,147,483,647. |
<int>27</int> <i4>27</i4> |
double |
64-bit floating-point numbers |
<double>27.31415</double> <double>-1.1465</double> |
Boolean |
true (1) or false (0) |
<boolean>1</boolean> <boolean>0</boolean> |
string |
ASCII text, though many implementations support Unicode |
<string>Hello</string> <string>bonkers! @</string> |
dateTime.iso8601 |
Dates in ISO8601 format: CCYYMMDDTHH:MM:SS |
<dateTime.iso8601>20021125T02:20:04 </dateTime.iso8601> <dateTime.iso8601>20020104T17:27:30 </dateTime.iso8601> |
base64 |
Binary information encoded as Base 64, as defined in RFC 2045 |
<base64>SGVsbG8sIFdvcmxkIQ== </base64> |
Tip
For more information on how Base 64 encoding works, see section 6.8 of RFC 2045, “Multipurpose Internet Mail Extensions (MIME) ...
Get Web Services Essentials now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.