JBoss EAP 6 Socket Timeout Settings

Latest response

I currently have a RESTful application deployed in JBoss EAP 6 that is making a service call to a SOAP service, however the SOAP response is taking longer than 60 seconds to calculate and return a response to the REST application.

JBoss is closing the socket at 60s and throwing a SocketTimeoutException. I've tried following the instructions on https://access.redhat.com/solutions/456733 by setting the DEFAULT_CONNECTION_TIMEOUT to longer than 60000 but JBoss is still closing the connection at 60s.

Is there a way, without any code changes to the REST application, to increase JBoss default 60s socket timer?

Thanks in advance for any assistance.

Responses

This worked for me . We wanted to set timeout of 5 hours (We had long running job).

//These packages are hidden from the compiler, but are available to the JVM //In eclipse there is way to get this working but maven cant compile //so had to declare the variables. //com.sun.xml.internal.ws.developer.JAXWSProperties.REQUEST_TIMEOUT public static final String REQUEST_TIMEOUT = "com.sun.xml.internal.ws.request.timeout"; //com.sun.xml.internal.ws.developer.JAXWSProperties.CONNECT_TIMEOUT public static String CONNECT_TIMEOUT = "com.sun.xml.internal.ws.connect.timeout";

//Java WS client ....Set timeout here....

EdxWebServiceImplService edxWebservice = new EdxWebServiceImplService(WsURL); EdxWebServiceImpl edxServicePort = edxWebservice.getEdxWebServiceImplPort();

//Set timeout on the client
BindingProvider edxWebserviceBindingProvider  = (BindingProvider)edxServicePort;
//In milli Seconds...
edxWebserviceBindingProvider.getRequestContext().put(REQUEST_TIMEOUT,WEBSERVICE_TIMEOUT_IN_MILLI_SECS);
edxWebserviceBindingProvider.getRequestContext().put(CONNECT_TIMEOUT,WEBSERVICE_TIMEOUT_IN_MILLI_SECS);
String response = edxServicePort.processRequest(reqXML);

However i notice that the above fix will work only when you run the client as stand alone java client (I used jre7). If I put the same client on Jboss container , I mean i plugged this client into one web application which runs on jboss red hat 7.1.2 app server, it still times out after 60 seconds, though on the client i did mention more than a minute as connection timeout.

So not sure why it works as stand alone java client and same thing fails when run on application server.

/*

/* //In milli Seconds... // can't be sure about which will be used. Set them all. //https://www.programcreek.com/java-api-examples/index.php?api=javax.xml.ws.wsaddressing.W3CEndpointReferenceBuilder //https://access.redhat.com/solutions/341683 Since stand alone java expects one set of properties depending on jdk you use and same properties dont work on application server we added all 3 combination of things here. */

//Set timeout on the client
BindingProvider edxWebserviceBindingProvider  = (BindingProvider)edxServicePort;
edxWebserviceBindingProvider.getRequestContext().put("com.sun.xml.internal.ws.request.timeout", connectionTimeoutInMilliSeconds);
edxWebserviceBindingProvider.getRequestContext().put("com.sun.xml.internal.ws.connect.timeout", connectionTimeoutInMilliSeconds);
edxWebserviceBindingProvider.getRequestContext().put("com.sun.xml.ws.request.timeout", connectionTimeoutInMilliSeconds);
edxWebserviceBindingProvider.getRequestContext().put("com.sun.xml.ws.connect.timeout", connectionTimeoutInMilliSeconds);
edxWebserviceBindingProvider.getRequestContext().put("javax.xml.ws.client.receiveTimeout", connectionTimeoutInMilliSeconds);
edxWebserviceBindingProvider.getRequestContext().put("javax.xml.ws.client.connectionTimeout", connectionTimeoutInMilliSeconds);