Thursday, May 17, 2007

XML-RPC namespace

Is it just me or does XML-RPC appear to not have a defined XML namespace?

I realize that most people are using XML-RPC as the entire XML document, so namespaces probably don't matter to them. But I'm implementing a job scheduler in which I am separating the scheduling logic from the job handling logic. I do this by defining a job as an XML document consisting of scheduling parameters and an XML-RPC method invocation. When it is time to execute the job, the scheduler acts as an XML-RPC client, making the method call to the job handler process (which is an XML-RPC server). In this context, my job's XML document consists of tags from two namespaces: my job scheduler tags and XML-RPC tags. XML namespaces solve the ambiguity, but XML-RPC doesn't appear to have a well-defined namespace.

Since this is a slighty out-of-the-ordinary usage of XML-RPC, perhaps an example would help illustrate the problem:

<?xml version="1.0" ?>
<job xmlns="http://www.nttmcl.com/kelly/jobsched">
<!-- Schedules are expressed in ISO-8601 notation. -->
<!-- For example, the following schedule says to
repeat 5 times 1 minute apart, starting on May
18th 2007 at midnight UTC. -->
<schedule>
R5/2007-05-18T00:00:00Z/PT1M
</schedule>
<action>
<methodCall xmlns="">
<methodName>ExecProcess</methodName>
<params><param><value>
<struct>
<member>
<name>path</name>
<value>/bin/echo</value>
</member>
<member>
<name>args</name>
<value>
<array><data>
<value>This is a test</value>
</data></array>
</value>
</member>
</struct>
</value></param></params>
</methodCall>
</action>
</job>

As you can see, currently, I'm just resetting the XML namespace for the XML-RPC <methodCall> tag (and all nested sub-tags) to an empty namespace. If XML-RPC has a well-defined namespace, however, I would feel much better using that. Please, if anyone is aware of the proper namespace declaration for XML-RPC please let me know. If not, I will gladly offer a unique URL in my personal domain for use as the official XML-RPC identifier: http://www.posi.net/xml-rpc/.

2 comments:

jjinux said...

XML-RPC was specifically meant to be dirt simple; it was a response to the complexity of SOAP. I wouldn't be surprised if they left out the namespace business on purpose.

Kelly Yancey said...

I figured it was because XML-RPC was implemented before XML namespaces were standardized (XML namespaces were introduced in late 1998/early 1999 and XML-RPC was implemented in 1998).

Since the XML-RPC spec hasn't really changed since 1998, I figured the authors never got around to declaring a namespace for their XML tags after the fact.