30 May 2018

Jax-ws timeout

 There are several properties to set timeout to WLS (or most web/app containers),

1.
Details for programming approach: https://docs.oracle.com/middleware/1213/wls/WSGET/jax-ws-jws.htm#WSGET168

Using: BindingProviderProperties.REQUEST_TIMEOUT

ie:

  requestContext.put(BindingProviderProperties.CONNECT_TIMEOUT, 3000);
  requestContext.put(BindingProviderProperties.REQUEST_TIMEOUT, 3000);


2.
Another approach is setting these values (this time in a Spring context):

    <!-- timeout -->
    <util:map id="jaxwsCustomProperties">
        <beans:entry key="com.sun.xml.ws.request.timeout">
            <beans:value type="java.lang.Integer">11000</beans:value>
        </beans:entry>
        <beans:entry key="com.sun.xml.ws.connect.timeout">
            <beans:value type="java.lang.Integer">11000</beans:value>
        </beans:entry>
    </util:map>



3.
Spring HTTP client:
https://docs.spring.io/spring-framework/docs/current/javadoc-api/org/springframework/http/client/HttpComponentsClientHttpRequestFactory.html

httpRequestFactory.setConnectionRequestTimeout(5000);        httpRequestFactory.setConnectTimeout(10000);       
httpRequestFactory.setReadTimeout(120000);

4.
These java properties probably are the most direct way (but as we know they'll impact the complete server):

-Dweblogic.https.client.defaultConnectTimeout=30000
-Dweblogic.http.client.defaultConnectTimeout=30000


OR

-Dweblogic.webservice.UseWebLogicURLStreamHandler=false
-DUseSunHttpHandler=true
-Dsun.net.client.defaultConnectTimeout=30000 

-Dsun.net.client.defaultReadTimeout=30000

All this happens by the default values:

sun.net.client.defaultConnectTimeout (default: -1 (forever))
sun.net.client.defaultReadTimeout (default: -1 (forever))

No comments :

Blog Archive

Disclaimer

The views expressed on this blog are my own and do not necessarily reflect the views of Oracle.