[jboss-user] [JBoss Web Services] - Request timeout - JAXWS

klind do-not-reply at jboss.com
Thu May 23 16:17:54 EDT 2013


klind [https://community.jboss.org/people/klind] created the discussion

"Request timeout - JAXWS"

To view the discussion, visit: https://community.jboss.org/message/819176#819176

--------------------------------------------------------------
Hi, I am trying to set the connect timeout and request time out on a webservice request.. 


public static ProfitWebService getProfitService(final String url) throws MalformedURLException {
                    QName qname = new QName(ProfitWebService.WS_TARGET_NAMESPACE, ProfitWebService.WS_NAME);
                    QName ProfitWebServicePort = new QName(ProfitWebService.WS_TARGET_NAMESPACE, ProfitWebService.WS_PORT);
                    URL wsdlURL = new URL(url + WSDL);
  
                    // This is not working.... 
                    try {
                              URLConnection openConnection = wsdlURL.openConnection();
                              openConnection.setConnectTimeout(Configuration.PROFIT_CONNECT_TIMEOUT*1000);
                              openConnection.setReadTimeout(Configuration.PROFIT_REQUEST_TIMEOUT*1000);
                    } catch (IOException e) {
                              // TODO Auto-generated catch block
                              e.printStackTrace();
                    }
  
                    Service service = Service.create(wsdlURL, qname);
                    ProfitWebService port = service.getPort(ProfitWebServicePort, ProfitWebService.class);
                    // This is not working....
                    BindingProvider binding = (javax.xml.ws.BindingProvider)port;
                    Map<String, Object> requestContext = binding.getRequestContext();
                    requestContext.put(BindingProviderProperties.CONNECT_TIMEOUT, Configuration.PROFIT_CONNECT_TIMEOUT*1000); 
                    requestContext.put(BindingProviderProperties.REQUEST_TIMEOUT, Configuration.PROFIT_REQUEST_TIMEOUT*1000);
  
                    // This is not working....
                    requestContext.put("com.sun.xml.internal.ws.request.timeout", Configuration.PROFIT_REQUEST_TIMEOUT*1000);
  
                    return port;
          }
 


But I cant get anything to work. 
In the webservice I sleep for a longer period that the request timeout... but no timeout is happening..
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/819176#819176]

Start a new discussion in JBoss Web Services at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2044]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20130523/da3ccd87/attachment.html 


More information about the jboss-user mailing list