Rox now supports a "vendor extension" to the XML-RPC specification. If you enable it then you can specify a request encoding on the client side. On the server side you can register multiple encodings which are looked up by name.
An example of an encoding would be a gzip encoding. After the approriate incantations the client will gzip it's payload before sending it and (optionally) indicate that it will accept gzipped content in the response. If the server has a handler registered for the gzip encoding it will unzip it and the server-side handler will never know the difference. And if the client indicated it's willing to accept gzipped encoded content in the response (by means of the Accept-Encoding HTTP header) then the server will do the honours. If not, the server will send back an unencoded response.
You can plug your own encodings in (Rox has support for a couple of compression encodings) so if you think there's an efficiency gain to be had by translating your XML-RPC tags into Klingon then who am I to stand in your way?
As part of interop testing I started to look at the Apache XML-RPC project's vendor extensions. It turns out they've implemented something similar but I'll need to use version 3 of their library and just the examples were enough to scare me off. Configuring the client to compress requests requires instantiating something called XmlRpcClientConfigImpl and then setting a bunch of properties (which I think are just string names) on this object. This is then passed to a setConfig() method.
It looks like they've done some work to decouple the tranport layer (HTTP) implementation, which is a good idea. It let's you plug in a replacement HTTP implementation when you realise how much the Java URLConnection implementations suck (although their example plugs in the Jakarta Commons HTTP implementation which isn't a whole lot better).
And I see lots and lots of factories. I don't have a problem with factories per se. They have their place. But I tend to lean towards sub-classing and factory methods, rather than factories. And given that the only way to provide a factory in the Apache implementation is to subclass, a factory method strikes me as simpler (since 90% of the time all you want to do is plug in a different implementation of something).
It looks (from a quick inspection) like they might support POJO serialization. It's not entirely clear. But I see as part of their vendor extensions they've added support for a bunch of new types. This is not a bad idea. If you control both ends of the pipe this could make things a lot easier for you. But, as part of this they seem to be heading down the XML namespace path. If you're planning to interoperate in the XML world then this is not a bad idea. It avoids collisions. But, one of the reasons XML-RPC avoided namespaces early on was because it seriously complicated things and it was always intended to be as simple as possible (one of the other reasons is that namespaces hadn't yet been finalized). I think namespaces in this context was the wrong decision.
They have decided to support passing XML-RPC method parameters as an Object array. I'm not going to argue (Rox does this too). This strikes me as far more natural since the 90% case involves a method with a static list of parameters. The overhead of a List is usually unwarranted. As an aside, for most of our internal APIs we ended up passing a single struct as parameter. This gives us "named" parameters and is far more future-proof since adding new fields can be done transparently (if required).
I'll admit I only spent about 5 minutes looking over the new API, and it's not all bad but, frankly, I think they've taken a step backwards.
Posted at 10:57 PM



