Handling the Apache CXF Java Client Timeout
If you are using CXF, you can control the client timeout by programmatically obtaining the HTTPConduit from the proxy and setting the ConnectionTimeout and ReceiveTimeout properties.
For example:
import org.apache.cxf.frontend.ClientProxy;
import org.apache.cxf.transport.http.HTTPConduit;
import org.apache.cxf.transports.http.configuration.HTTPClientPolicy;
import com.primavera.ws.p6.job.JobPortType;
//...
JobPortType port = testCase.getJobServicePort();
org.apache.cxf.endpoint.Client client = ClientProxy.getClient(port);
HTTPConduit httpConduit = (HTTPConduit)client.getConduit();
HTTPClientPolicy policy = httpConduit.getClient();
// set time to wait for response in milliseconds. zero means unlimited
policy.setReceiveTimeout(0);
Or, you can control the client timeout by modifying the spring configuration for the client http-conduit file.
Please refer to the CXF User's Guide for information about using the http-conduit file to control the client timeout. At the time of this writing, the CXF User's Guide was available at http://cwiki.apache.org/CXF20DOC.
Last Published Thursday, May 2, 2024