Platinum Partner
java,enterprise-integration,xml,architecture,integration,tips and tricks

Apache XML-RPC: How to configure timeouts in XML-RPC client?

Apache XML-RPC is a Java implementation of XML-RPC, a popular protocol that uses XML over HTTP to implement remote procedure calls.

Here’s how timeouts can be configured for an XML-RPC client:

XmlRpcClient client = new XmlRpcClient();
XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl();

// Setting timeouts for xmlrpc calls made using XmlRpcSunHttpTransportFactory, the default connection factory int xmlrpcConnTimeout = 10000; // Connection timeout
int xmlrpcReplyTimeOut = 60000; // Reply timeout

XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl();

config.setServerURL(new URL(serverURL));
config.setConnectionTimeout(xmlrpcConnTimeout);
config.setReplyTimeout(xmlrpcReplyTimeOut);
client.setConfig(config);

Published at DZone with permission of {{ articles[0].authors[0].realName }}, DZone MVB. (source)

Opinions expressed by DZone contributors are their own.

{{ tag }}, {{tag}},

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}
{{ parent.authors[0].realName || parent.author}}

{{ parent.authors[0].tagline || parent.tagline }}

{{ parent.views }} ViewsClicks
Tweet

{{parent.nComments}}