我正在使用JAX-Ws客户端来调用web服务.Web服务运行一段时间(比如20-30分钟)。 但是在3-4分钟后,我在客户端获得以下异常。
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)
我虽然可能因为客户端超时而增加了以下时间的可变时间。但没有运气。同样在服务器上,我看到web服务仍在执行。
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....
答案 0 :(得分:-1)
我认为问题出在apache httpd webserver上,默认超时为120秒。
我们所有的webservice调用都通过负载均衡器(apache httpd服务器),然后发送到Jboss应用服务器。
因此更改了httpd.conf文件中appache webserver的以下属性值。
Timeout 120
到
Timeout 18000
即5小时
此更改是对JAX-WS客户端代码更改的补充。