This is the Title of the Book, eMatter Edition
Copyright © 2007 O’Reilly & Associates, Inc. All rights reserved.
History of XML-RPC
|
41
has no native understanding of success versus failure in XML-RPC terms. An HTTP
server only knows if it was able to successfully handle a request and send a valid
response. HTTP error codes in the 400 (request incomplete) or 500 (server error)
ranges can indicate only that the HTTP server had problems, not the XML-RPC
code.
Any time a server receives a request and can give a response, the HTTP response
code must be
200, the basic HTTP success indicator. This holds true for faults as well
as successful returns, which is why faults are used to communicate problems. The
range of fault types for XML-RPC is theoretically unbounded, but the range of error
codes for HTTP is finite. Additionally, not all servers can attach arbitrary documents
to error messages. In other words, HTTP error codes just wouldn’t work. So, unless
the URL is invalid, or the server is down, the HTTP layer reports success.
Example 3-7 shows the same response message as Example 3-5, but with server-side
headers and the HTTP response line added. The content is abbreviated, and depend-
ing on the server in use, the complete set of headers may be much longer.
In Chapter 4, when toolkits are discussed, we will cover the merits of using an
Apache server with
mod_perl enabled. Suffice it to say, mod_perl can make an XML-
RPC environment even more efficient, when coded and configured properly.
Method Signatures and Overloading
By design, XML-RPC treats the remotely executable procedures as strongly typed.
While languages such as Perl or PHP may operate fine with arbitrary parameters
passed in, languages such as Java and C are much more demanding about the integ-
rity of their arguments list. Many server implementations address this by tracking the
number, order, and type of parameters a procedure or method may accept. This is
often referred to as the signature of the remote call.
Example 3-7. XML-RPC response with HTTP headers
HTTP/1.1 200 OK
Connection: close
Content-Length: 138
Content-Type: text/xml
Date: Sun, 28 Jul 2002 11:20:13 GMT
Server: Apache/1.3.23 (Unix) mod_perl/1.26
<?xml version="1.0"?>
<methodResponse>
<params>
<param>
<value><int>1</int></value>
</param>
</params>
</methodResponse>

Get Programming Web Services with Perl 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.