I\'m working on a WebService Client and I want to set a Timeout for my WebService Call. I have tried different approaches but still I\'m not able to achieve this. I\'m using
You could try these settings (they are paired to be used in pairs)
BindingProviderProperties.REQUEST_TIMEOUT
BindingProviderProperties.CONNECT_TIMEOUT
BindingProviderProperties should be from com.sun.xml.internal.WS.client
Or the strings for JBoss:
javax.xml.ws.client.connectionTimeout
javax.xml.ws.client.receiveTimeout
All properties to be put on getRequestContext() in milliseconds.
(BindingProvider)wsPort).getRequestContext().put(BindingProviderProperties.REQUEST_TIMEOUT, yourTimeoutInMillisec);
For JBoss specifically, you might want to use the property StubExt.PROPERTY_CLIENT_TIMEOUT from org.jboss.ws.core.StubExt. See this thread for details.