Next: SOAP
Up: Web Services
Previous: CGI, Servlets, and the
  Contents
Web services were born when Dave Winer decided, when developing Frontier, that he needed
a ``simple-enough-that-it-will-work'' strategy for calling procedures on remote computers across
language and platform boundaries. Then and now XML was all the buzz; so, when cooking-up
his solution he decided to sprinkle a bit of XML on the dish. The result was XML-RPC.
XML-RPC is a remote procedure protocol which sends XML missives over the wire using the protocol
of love, HTTP. Here, for exmample, is an XML-RPC request to call the procedure examples.getStateName
remotely
POST /RPC2 HTTP/1.0
User-Agent: Frontier/5.1.2 (WinNT)
Host: betty.userland.com
Content-Type: text/xml
Content-length: 181
<?xml version="1.0"?>
<methodCall>
<methodName>examples.getStateName</methodName>
<params>
<param>
<value><i4>41</i4></value>
</param>
</params>
</methodCall>
and here the response to our example query
HTTP/1.1 200 OK
Connection: close
Content-Length: 158
Content-Type: text/xml
Date: Fri, 17 Jul 1998 19:55:08 GMT
Server: UserLand Frontier/5.1.2-WinNT
<?xml version="1.0"?>
<methodResponse>
<params>
<param>
<value><string>South Dakota</string></value>
</param>
</params>
</methodResponse>
In fixing the eye long enough on these simple examples you can ascertain the gist of XML-RPC. The protocol is dead-simple
and this is its major strength. XML-RPC, unlike CORBA, does not rely on any fancy-pants ORB that may or may not be able to
interoperate with other ORB's, nor does XML-RPC, unlike XDR, rely one some arcane serialization protocol derived in the days
when dinasours roamed the earth. XML-RPC is packed with goodness from head-to-toe. It is this which motivated people
to seriously start looking into XML-RPC.
While XML-RPC was based upon wholesome goodness from the zenith of its head to the nadir of its toes, in applying it to
domains distant from the original Frontier sand-box, it began to show growing pains. For example, the data types which
XML-RPC can shuffle to-and-fro are so simple as to work, but a bit too simple as to be the end-all RPC solution. For
example, here is the entire type specification for XML-RPC data types from the Vulgate on these matters, the XML-RPC
standard
Scalar <value>s
<value>s can be scalars, type is indicated by nesting the value inside one of the tags listed in this table :
Table:
XML RPC scalar values
| Tag |
Type |
| <i4> or <int> |
four-byte signed integer |
| <boolean> |
0 (false) or 1 (true) |
| <string> |
ASCII string |
| <double> |
double-precision signed floating point number |
| <dateTime.iso8601> |
date/time |
| <base64> |
base64-encoded binary |
|
If no type is indicated, the type is string.
<struct>s
A value can also be of type <struct>.
A <struct> contains <member>s and each <member> contains a <name> and a <value>.
Here's an example of a two-element <struct>:
<struct>
<member>
<name>lowerBound</name>
<value><i4>18</i4></value>
</member>
<member>
<name>upperBound</name>
<value><i4>139</i4></value>
</member>
</struct>
<struct>s can be recursive, any <value> may contain a <struct> or any other type, including an <array>, described
below.
<array>s
A value can also be of type <array>.
An <array> contains a single <data> element, which can contain any number of <value>s.
Here's an example of a four-element array:
<array>
<data>
<value><i4>12</i4></value>
<value><string>Egypt</string></value>
<value><boolean>0</boolean></value>
<value><i4>-31</i4></value>
</data>
</array>
<array> elements do not have names.
You can mix types as the example above illustrates.
<arrays>s can be recursive, any value may contain an <array> or any other type, including a <struct>,
described above.
The XML-RPC primitive type system, though flexible, isn't as filigreed or festooned as the baroque arabesque
that is the XML primitive type system; one can easily glean this by comparing the above lean-mean solution
to the more rococo arabesque of figure . This, among other things, was a motivation
to introduce WSDL, a similar but all together more advanced RPC protocol, with progenitor XML-RPC,
that can make use of the rococo arabesque of figure . However, before revisiting WSDL
we'll take a look at the engine behind much of WSDL's success SOAP.
Next: SOAP
Up: Web Services
Previous: CGI, Servlets, and the
  Contents
Andre Merzky
2004-05-13
|