klind
2013-05-23 20:17:54 UTC
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]
"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]