XML - Managing Data Exchange/XMLRPC - Serializing/Deserializing DataTypes< XML - Managing Data Exchange
|This page needs a history merge with XML - Managing Data Exchange/RPC.
A Wikibooks administrator should take care of this shortly.
|Previous Chapter||Next Chapter|
|← OpenOffice.org & OpenDocument Format||Google earth →|
XMLRPC - Serializing and Deserializing DatatypesEdit
As a lightweight alternative to SOAP, Dave Winer came up with XMLRPC as a means to make remote method calls and exchange data between servers. The spec for this format is located at http://www.xmlrpc.com/spec.
It works well for its intended use. Well, unless you are coding in PHP and using the built-in, undocumented functions to generate XMLRPC. You may have to build your own, just to be on the safe side.
Just a quick example of what it looks like. In xmlrpc, a <struct> is what we would call in php an 'associative array', whereas an <array> is a 'list' or an array with only numerical indices (or in some languages, no indices). A complex array datatype with the following structure:
Array (  => dogs  => cats [animals] => Array(  => FALSE  => little_dogs  => little_cats  => 5  => 2.3  => 1 ), )
Becomes the following XMLRPC:
<?xml version="1.0" encoding="utf-8"?> <methodResponse> <params> <param> <value> <struct> <member> <name>0 </name> <value><string>dogs</string> </value> </member> <member> <name>1 </name> <value><string>cats</string> </value> </member> <member> <name>animals </name> <value> <array> <data> <value><boolean>0</boolean> </value> <value><string>little_dogs</string> </value> <value><string>little_cats</string> </value> <value><i4>5</i4> </value> <value><double>2.3</double> </value> <value><boolean>1</boolean> </value> </data> </array> </value> </member> </struct> </value> </param> </params> </methodResponse>