Apache XML-RPC: How to configure timeouts in XML-RPC client?
Join the DZone community and get the full member experience.
Join For FreeApache 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 Singaram Subramanian, DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.
Comments