Search code examples
javawebspherecxfwebsphere-8

Response Timeout Property in CXF


We are currently in the process of migrating out of WebSphere to an open source Application server (preferably Tomcat), so as a step 1, I am trying to migrate the code that used Websphere Webservice jars into CXF. I was able to get all the things done except one.

com.ibm.wsspi.webservices.Constants.RESPONSE_TIMEOUT_PROPERTY

I am just unable to trace anything similar in CXF to this. The only thing remotely close to it is:

org.apache.cxf.message.Message.RECEIVE_TIMEOUT

There are a few other timeouts available in CXF, just not sure which one to use, as this is the first time dealing with this API.


Solution

  • You could take a look at HTTPClientPolicy from Apache CXF

    Example:

    Client client = ClientProxy.getClient(port);
    HTTPConduit http = (HTTPConduit) client.getConduit();
    HTTPClientPolicy httpClientPolicy = new HTTPClientPolicy();
    httpClientPolicy.setReceiveTimeout(30000L);
    http.setClient(httpClientPolicy);
    

    Read more on the following URL to see other properties (including other types of timeouts): http://cxf.apache.org/javadoc/latest/org/apache/cxf/transports/http/configuration/HTTPClientPolicy.html