How to set JAX-WS client timeout?

11,957

I did the following steps and fixed the problem:

  1. Upgraded jbossws-native library, follow this link.
    jbossws-native-3.4.0 is the latest supported version for Jboss 5.1.0GA. You can see JBossWS - Supported Target Containers

  2. Used StubExt.PROPERTY_CLIENT_TIMEOUT

    int timeoutMillisecond=3000;
    bp.getRequestContext().put(StubExt.PROPERTY_CLIENT_TIMEOUT, timeoutMillisecond);
    

By the way, in this version StubExt.PROPERTY_CONNECTION_TIMEOUT also works correctly.

Share:
11,957
JiboOne
Author by

JiboOne

Updated on June 28, 2022

Comments

  • JiboOne
    JiboOne almost 2 years

    I'm developing Jax-ws client on Jboss 5.1.0 GA. I want to set web service client timeout.

    I've tried StubExt.PROPERTY_CLIENT_TIMEOUT.

    int timeoutMillisecond=3000;
    bp.getRequestContext().put(StubExt.PROPERTY_CLIENT_TIMEOUT, timeoutMillisecond);
    

    It works but exception is thrown only after 3*timeoutMillisecond (after 9000 millisecond), but 3000ms is written in log file.

    2012-12-24 15:42:40,053 DEBUG Sending request
    2012-12-24 15:42:49,057 ERROR WebServiceException returned: 
    javax.xml.ws.WebServiceException: org.jboss.ws.core.WSTimeoutException: Timeout after: 3000ms
    

    I've rtied also many other ways

    bp.getRequestContext().put("com.sun.xml.ws.connect.timeout", 100);
    bp.getRequestContext().put("com.sun.xml.ws.request.timeout", 100);
    // from com.sun.xml.ws.developer.JAXWSProperties
    bp.getRequestContext().put(JAXWSProperties.CONNECT_TIMEOUT, 100);
    bp.getRequestContext().put(JAXWSProperties.REQUEST_TIMEOUT, 100);
    

    But nothing worked on Jboss 5.1


    Could you tell me how to set client timeout correctly ?