XML - Managing Data Exchange/XMLRPC - Serializing/Deserializing DataTypes

From Wikibooks, open books for an open world
Jump to: navigation, search

Xml book cover wiki.png XML - Managing Data Exchange
Related Topics
Computer Science Home
Library and Information Science Home
Markup Languages
Get Involved
To do list
Contributors list
Contributing to Wikibooks
Previous Chapter Next Chapter
OpenOffice.org & OpenDocument Format Google earth

XMLRPC - Serializing and Deserializing Datatypes[edit]

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:

        [0] => dogs
        [1] => cats
        [animals] => Array(
                [0] => FALSE
                [1] => little_dogs
                [2] => little_cats
                [3] => 5
                [4] => 2.3
                [5] => 1

Becomes the following XMLRPC:

<?xml version="1.0" encoding="utf-8"?>