title: JAX-WS webservice client : The server sent HTTP status code 504: Gateway Time-out
body: <p>I am using a JAX-Ws client to invoke a webservice.The webservice runs for a while (say 20-30 minutes).
  However after 3-4 minutes I get the following exception on the client side.</p>
  
  <p><pre></p>
  
  <p>The server sent HTTP status code 504: Gateway Time-out:com.sun.xml.internal.ws.client.ClientTransportException: The server sent HTTP status code 504: Gateway Time-out
      at com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.checkStatusCode(HttpTransportPipe.java:296)
      at com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.createResponsePacket(HttpTransportPipe.java:245)
      at com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.process(HttpTransportPipe.java:203)
      at com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.processRequest(HttpTransportPipe.java:122)
      at com.sun.xml.internal.ws.transport.DeferredTransportPipe.processRequest(DeferredTransportPipe.java:95)
      at com.sun.xml.internal.ws.api.pipe.Fiber.__doRun(Fiber.java:626)
      at com.sun.xml.internal.ws.api.pipe.Fiber._doRun(Fiber.java:585)
      at com.sun.xml.internal.ws.api.pipe.Fiber.doRun(Fiber.java:570)
      at com.sun.xml.internal.ws.api.pipe.Fiber.runSync(Fiber.java:467)
      at com.sun.xml.internal.ws.client.Stub.process(Stub.java:308)
      at com.sun.xml.internal.ws.client.sei.SEIStub.doProcess(SEIStub.java:146)
      at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:98)
      at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:78)
      at com.sun.xml.internal.ws.client.sei.SEIStub.invoke(SEIStub.java:129)
      at com.sun.proxy.$Proxy31.processRequest(Unknown Source)
      at com.fmer.bsc.test.EdxWebServiceInvokerThread.call(EdxWebServiceInvokerThread.java:57)
      at com.fmer.bsc.test.EdxWebServiceInvokerThread.call(EdxWebServiceInvokerThread.java:1)
      at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
      at java.util.concurrent.FutureTask.run(FutureTask.java:166)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
      at java.lang.Thread.run(Thread.java:724) 
  </pre></p>
  
  <p>I though it could because of client timing out and added the the time out varaibles as below.Still no luck. Also on server I see the webservice is still executing.</p>
  
  <pre>
  
  private static Integer timeOut = new Integer((10 * 60 * 60 * 1000)); //Read as 1O hrs * 60 min * 60 seconds * 1 milli second
  
  
  //Setting the Request timeout and connection time out 
  EdxWebServiceImplService edxWebservice = new EdxWebServiceImplService(WsURL);
  edxServicePort = edxWebservice.getEdxWebServiceImplPort();
  BindingProvider edxWebserviceBindingProvider  = (BindingProvider)edxServicePort;
  
  //In milli Seconds...
  edxWebserviceBindingProvider.getRequestContext().put(JAXWSProperties.CONNECT_TIMEOUT,timeout);
  edxWebserviceBindingProvider.getRequestContext().put(JAXWSProperties.REQUEST_TIMEOUT,timeOut);
  
  //Now invoke the webservice....
  
  
  </pre>