BYTE.com > Features > 1999 > August
Anatomy Of An XML-RPC Transaction
By Jon Udell
August 30, 1999
(Exploring XML-RPC
: Page 4 of 5 )
An XML-RPC request can be as easily read and written by a human as
by a program. That's one of the great features of all Internet
software: the protocols (HTTP, SMTP, NNTP) are text-based and
therefore easy to understand and to manipulate in any programming
language.
Of course, that's also true for ordinary scripted CGI work, such as
our mindshare-measuring script. What's special about XML-RPC? Well,
consider the response that comes back when you send the wrong password
to the MailToTheFuture service using the normal CGI interface:
"Sorry! There was an error: Can't send you the cookie for 'yourname@yourmailhost.com' because the password is incorrect."
You can certainly teach your script to recognize and deal with
these kinds of responses, but it's going to be a fragile mechanism.
You're relying on free-form text patterns and, when they change, your
script will break. In the case of our mindshare-measuring script, for
example, a page redesign at either Yahoo or Alta Vista will very
likely force the script to have to recognize new patterns in the
output from these components.
Now consider the response that comes back from MailToTheFuture's
XML-RPC interface when you send the wrong password:
<?xml version="1.0"?>
<methodResponse>
<fault>
<value>
<struct>
<member>
<name>faultCode</name>
<value>
<int>4</int>
</value>
</member>
<member>
<name>faultString</name>
<value>
<string>The password is incorrect.</string>
</value>
</member>
</struct>
</value>
</fault>
</methodResponse>
Like the request, this response is well-formed -- and thus
automatically parseable -- XML.
BYTE.com > Features > 1999 > August
|