To set the Service call Connection and Request timeouts in the JAX-WS Client implementations for specific services, once the Proxy is created we need to do the following:
1. Cast the Proxy to the javax.xml.ws.BindingProvider
2. Fetch the Request Context (java.util.Map<String, Object>)
3. Set the timeout properties, as demonstrated in the following snippet of code below. Please note that the keys for the entries are 'com.sun.xml.ws.connect.timeout' and 'com.sun.xml.ws.request.timeout', for connection timeout and request timeout respectively, which are added to the RequestContext Map
1. Cast the Proxy to the javax.xml.ws.BindingProvider
2. Fetch the Request Context (java.util.Map<String, Object>)
3. Set the timeout properties, as demonstrated in the following snippet of code below. Please note that the keys for the entries are 'com.sun.xml.ws.connect.timeout' and 'com.sun.xml.ws.request.timeout', for connection timeout and request timeout respectively, which are added to the RequestContext Map
private void setYourServiceCallTimeOut(YourPort yourPort){ if (logger.isDebugEnabled()) { logger.debug(":setYourServiceCallTimeOut(): Entering method."); } java.util.MaprequestContext = ((javax.xml.ws.BindingProvider)docPublisherPort).getRequestContext(); requestContext.put("com.sun.xml.ws.connect.timeout", 15000); requestContext.put("com.sun.xml.ws.request.timeout", 15000); if (logger.isDebugEnabled()) { logger.debug(":setYourServiceCallTimeOut():Exiting method."); } }
Are the units in seconds or milliseconds?
ReplyDeletegood one.
ReplyDelete