Friday, March 25, 2005

XML-RPC, SOAP, etc...

1. XML-RPC

A XML file is used to describe a procedure invocation -- the method name is mapped by the server/CGI interface as some executable resources to access, and the arguments can be of scalar and non scalar (such as array a structures) types. The method invocation returns through a XML file that defines the set of returned results or errors.

Here's a HOWTO/tutorial on XML-RPC.

BLOB upload can be problematic, an alternative is described here. An implementation on the client side can reuse the user agent created for the Frontier::Client and the returned XML decoded through the client {'enc'}->decode method. On the server side, a Frontier::RPC2 object can be created in order to use the encore_response method to produce the returned XML.

2. SOAP

SOAP (Simple Object Access Protocol) is a XML based protocol to let applications exchange information over HTTP. XML is used to transport the message featuring:

  • An enveloppe (to identify the message as a SOAP message)
  • Optional header
  • A body containing call and response
  • Optional Fault section for error reporting on message processing
A SOAP method is an HTTP request/response that complies with the SOAP encoding rule (HTTP + XML = SOAP.) A SOAP request can be an HTTP POST or GET request. Content-Type can for instance be application/soap+xml; charset=utf-8.

3. Comparison

I found this comparison of XML-RPC/SOAP interesting.

XML-RPC is really simple and to the point. SOAP picks things up where XML-RPC left them and tends to be bigger and bloatier. It is endorsed by the big of the industry (IBM and M$, with IBM having the most complete implementation.)

4. Implementation

XML-RPC seem to be enjoying the vastest array of implementation: Python, C, C++, Java and Perl to name a few. Available and open SOAP implementation seem to be written in Java but there's at least one C++ based implementation. SOAP C++ implementation is here (but it's unclearwhether Java is required or not...)

XML-RPC seems to be fairly easy to integrate at the Perl CGI/bin level. The Frontier::RPC2 module provides what is required for XML input parsing and output formating -- it pretty much works straight out of the box but base64 support is said to be buggy. An alternative to try would be RPC::XML.

Note on the perl stuff. If you're accessing through https, you will get a `Protocol scheme 'https' is not supported' if IO::Socket::SSL isn't installed on the client (for a second you might thing it's a Frontier package problem but it's not.) Also, once you created a server, setting $server->{'debug'} will turn debug printout on. But for some errors, its lacking a bit and you're better off exploring the content of the returned value in Frontier::call() (an HTTP code is alway printed though.)

Something else I haven't read yet: Zope and XML-RPC here.

A modern use of SOAP is SOA (Service Oriented Architecture.) There's a description of SOA here.

Labels:

0 Comments:

Post a Comment

<< Home