Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

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

DZone's Guide to

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

Free Resource

Modernize your application architectures with microservices and APIs with best practices from this free virtual summit series. Brought to you in partnership with CA Technologies.

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);

The Integration Zone is proudly sponsored by CA Technologies. Learn from expert microservices and API presentations at the Modernizing Application Architectures Virtual Summit Series.

Topics:

Published at DZone with permission of Singaram Subramanian, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

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

{{ parent.tldr }}

{{ parent.urlSource.name }}