Skip to main content

Posts

Showing posts from July, 2009

Cookie handling with Apache XML-RPC

The example on the Apache website that explains how to pass cookies when calling an XML-RPC service is unfortunately... a bit b0rked. It doesn't compile, for starters. It's also quite a bit more complicated (and handwavy) than it needs to be. I don't know if this is because the API has changed over time. I tend to think it has suffered the copy-paste equivalent of chinese whispers from an origin in some mailing list. Anyway, I needed to send a single sign on (SSO) cookie to an XML-RPC service recently. I'm using Apache XML-RPC 3.1 (I notice in the Javadoc that this code might be slightly different if you're using a later version). Here's roughly what I did: First, the standard, boring stuff: XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl(); config.setServerURL(new URL("https://myservice.com/api")); XmlRpcClient client = new XmlRpcClient(); client.setConfig(config); Now, the juicy part. It's really, really easy. Look, ma, so much less …