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

Learn how API management supports better integration in Achieving Enterprise Agility with Microservices and API Management, brought to you in partnership with 3scale

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

Unleash the power of your APIs with future-proof API management - Create your account and start your free trial today, brought to you in partnership with 3scale.

Topics:

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

Opinions expressed by DZone contributors are their own.

THE DZONE NEWSLETTER

Dev Resources & Solutions Straight to Your Inbox

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

X

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

{{ parent.tldr }}

{{ parent.urlSource.name }}