I need to run a XmlRpc-Request and i must use a proxy to connect with the server.
The Connection works with the following code.
try {
final XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl();
config.setServerURL(new URL(url));
final XmlRpcClient server = new XmlRpcClient();
server.setConfig(config);
Object result = null;
System.setProperty("https.proxyHost", host);
System.setProperty("https.proxyPort", port);
result = server.execute("evatrRPC", params);
return ((String) result);
}catch (final Exception exception) {
throw new RuntimeException("JavaClient: " + exception);
}
The problem is that I am not allowed to change the system-properties. Therefor I am looking for an other way to just set a proxy for the request.
Thank you for your help
You should try to configure the transport factory of the client:
XmlRpcSun15HttpTransportFactorytransportFactory transportFactory =
new XmlRpcSun15HttpTransportFactory(client);
transportFactory.setProxy(proxy); // <= Proxy settings here
client.setTransportFactory(transportFactory);