If you're not familiar with XML-RPC, you can read up on it here.
Continue reading for the HOWTO.
Step 1, set the XML-RPC server URL in an XmlRpcClientConfigImpl object. Step 2, create a new XmlRpcClient object, and set the XmlRpcClientConfigImpl as its config. Step 3, create a new XmlRpcCommonsTransportFactory and a new HttpClient. Step 4, set the proxy you wish to use with the HttpClient using the setProxyHost() or setProxy() methods. Step 5, call setHttpClient() on the transport factory to set the HTTP client to the one you just created with the proxy configuration. Step 6, set the transport factory on the XmlRpcClient using setTransportFactory().
Here's some sample code ...
XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl();
config.setServerURL( serverURL );
client = new XmlRpcClient();
client.setConfig( config );
XmlRpcCommonsTransportFactory transportFactory
= new XmlRpcCommonsTransportFactory( client );
HttpClient httpClient = new HttpClient();
HostConfiguration hostConfiguration = httpClient.getHostConfiguration();
hostConfiguration.setProxy( "proxy.example.com", 8088 );
hostConfiguration.setHost( serviceURL );
transportFactory.setHttpClient( httpClient );
client.setTransportFactory( transportFactory );
That's it!


Did you find this post helpful, or at least, interesting?