Calling All XML

The function call is the fundamental unit of programming. Virtually every modern program begins, at least under the hood, with a call to the main function. From there, data is read into the program, transformed, and written back to some source -- all via function calls. In Windows, literally hundreds of function calls are triggered in response to each keystroke, and those hundreds of function calls help enrich the user experience. It only seems right that this powerful paradigm shouldn’t stop at the network wire. In fact, there are many proprietary techniques for a machine to invoke a function on another machine. Many vendors, including Microsoft, and open source groups are now proposing XML to elevate the remote procedure call (RPC) from a proprietary solution among homogeneous operating systems to a global standard accessible to almost any machine on the Internet.

To call a function on another machine, two things have to happen. First, a server program on the target machine must be prepared to invoke a function on your behalf. Next, the input parameters and results of the function call must be marshaled -- transmitted in an agreed upon format -- between the two machines.

The idea behind XML-RPC is to describe these remote requests and responses using industry standard XML. Instead of using an operating system dependent method to perform a remote procedure call, a package of XML information is posted to the target machine -- typically on the same port where the Web server is listening -- resulting in a function call on the target. The response comes back as a similarly formatted XML package. Specifications and example implementations of XML-RPC are available at www.xml-rpc.com.

DevelopMentor, UserLand, and Microsoft recently proposed a variation on the XML-RPC theme known as Simple Object Access Protocol (SOAP). SOAP appears to be a more complete and robust specification of XML-RPC. Specifically, SOAP adds hooks for transaction control, support for polymorphic data types such as Variants, namespaces to disambiguate method names, better versioning, and an optional new HTTP verb to help administrators secure SOAP servers. SOAP seems to be a platform-independent standard that doesn’t favor Windows in any obvious way, other than supporting Variant parameters, a particular convenience when marshalling COM calls.

While a verbose format like XML may not be the most expedient mechanism for pushing lots of information between machines, a plain-text mechanism like XML-RPC has its advantages. Debugging RPC calls and marshalling issues can be done using simple human-readable text. By encoding a method call of arbitrary complexity into a single text string, otherwise complex problems such as queuing up multiple operations can be performed with a simple string array. Message-queuing middleware, for example, can be simplified substantially using XML-RPC.

One of the determining factors that will affect any type of XML-RPC adoption is the availability of robust clients and servers. While XML-RPC may elegantly solve the cross-platform function call problem, most programs require abstractions that offer simplicity beyond a raw XML message. Visual Basic programmers, for example, will still want to use COM objects to communicate with other systems. An XML-RPC COM client, for example, could present a normal COM object to the programmer. Under the hood, the instantiated COM object might serialize its contents as an XML-RPC document each time it calls a server, and deserialize the results of the call back to the instantiated object. Java programmers would expect a similar level of transparency for Java objects.

The beauty of XML-RPC implementations is that a single server can serve responses to any XML-RPC aware client, whether that client is COM, Java, Perl, C++, or a Web browser. The client and server platforms need not be related, other than supporting HTTP protocol. Additionally, XML-RPC calls are ideal for making calls to stateless servers, because a client can easily package its current state within the payload of an XML-RPC request.

A universal mechanism for calling methods on any machine on the planet is truly exciting. We’ve either prototyped or developed a similar mechanism at each of my last two companies, so I’m convinced the need is real. SOAP seems to be the XML-RPC variation with the best chance of becoming a standard: Implementations will be available soon from Rogue Wave, Iona, Microsoft, DevelopMentor, UserLand, and others. We can only hope that Microsoft’s name on the draft standard doesn’t delay its adoption. In any case, XML-RPC is arriving, and not a moment too soon. --Eric Binary Anderson has led projects at a number of enterprise software companies and is currently the senior architect at IBT Financial, an Internet-based training company in Bend, Ore. Contact him at ebinary@columnist.com.

Must Read Articles