1 Reply Latest reply on May 23, 2013 7:58 PM by klind

    Request timeout - JAXWS

    klind Newbie

      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();
                          } catch (IOException e) {
                                    // TODO Auto-generated catch block
                          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..