javax.xml.ws.WebServiceException使用jax-ws从soap请求超时

时间:2016-05-05 05:28:11

标签: web-services soap jenkins jax-ws

我在jenkins中运行构建时遇到以下异常。

这就是我做的事情

  1. 我通过运行以下命令创建了java文件 wsimport -keep -verbose http://foobar.com/ws/server?wsdl

  2. 我将创建的文件复制到我的项目中并用它来构建客户端存根

  3. 以下是我的客户的外观

    public class SoapClient {
    
       private ServiceSoap soapService;
    
        //30 secs
        private static final Integer REQUEST_TIMEOUT_MILLI = 90000;
        //15 secs
        private static final Integer CONNECT_TIMEOUT_MILLI  = 90000;
    
        public SoapClient(){
            Service service = new Service();
            service.setHandlerResolver(new JaxWsHandlerResolver());
            soapService = service.getServiceSoap();
            ((BindingProvider)soapService).getRequestContext()
           .put(BindingProviderProperties.REQUEST_TIMEOUT,REQUEST_TIMEOUT_MILLI);
            ((BindingProvider)soapService).getRequestContext()
                    .put(BindingProviderProperties.CONNECT_TIMEOUT,CONNECT_TIMEOUT_MILLI);
        }
    
        public SoapResponse processRequest(String refNum){
            SoapResponse response = null;
            try {
               response = soapService.requestInfo(refNum); 
            }
            catch (Exception ex){
                LOG.error("error connecting to Soap service, {}",ex.getLocalizedMessage());
                LOG.error(ex.getMessage());
                LOG.error(ex.getCause().toString());
                ex.printStackTrace();
    
            }
            return response;
        }
    

    }

  4. 我已设置连接并请求超时。我增加了10分钟。直到我看到同样的例外。我在我的pom.xml

  5. 中包含了jaxws-rt依赖项

    这是

          <dependency>
                <groupId>com.sun.xml.ws</groupId>
                <artifactId>jaxws-rt</artifactId>
                <jaxws.version>2.2.10</jaxws.version>
            </dependency>
    

    以下是我看到的例外情况

    2016-05-05 04:43:40,337 [main] ERROR foo.bar.foobar.client.SoapClient - java.net.SocketTimeoutException: Read timed out
    javax.xml.ws.WebServiceException: java.net.SocketTimeoutException: Read timed out
        at com.sun.xml.ws.transport.http.client.HttpClientTransport.readResponseCodeAndMessage(HttpClientTransport.java:210)
        at com.sun.xml.ws.transport.http.client.HttpTransportPipe.createResponsePacket(HttpTransportPipe.java:241)
        at com.sun.xml.ws.transport.http.client.HttpTransportPipe.process(HttpTransportPipe.java:232)
        at com.sun.xml.ws.transport.http.client.HttpTransportPipe.processRequest(HttpTransportPipe.java:145)
        at com.sun.xml.ws.transport.DeferredTransportPipe.processRequest(DeferredTransportPipe.java:110)
        at com.sun.xml.ws.api.pipe.Fiber.__doRun(Fiber.java:1136)
        at com.sun.xml.ws.api.pipe.Fiber._doRun(Fiber.java:1050)
        at com.sun.xml.ws.api.pipe.Fiber.doRun(Fiber.java:1019)
        at com.sun.xml.ws.api.pipe.Fiber.runSync(Fiber.java:877)
        at com.sun.xml.ws.client.Stub.process(Stub.java:463)
        at com.sun.xml.ws.client.sei.SEIStub.doProcess(SEIStub.java:191)
        at com.sun.xml.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:108)
        at com.sun.xml.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:92)
        at com.sun.xml.ws.client.sei.SEIStub.invoke(SEIStub.java:161)
        at com.sun.proxy.$Proxy50.requestInfo(Unknown Source)
        at 
    

    异常似乎与sun有关。我看过其他帖子。但实际上没有人帮助我。我被困在这里两天,这里的任何帮助都将非常感激。

    由于

    修改 我几乎看到与here相同的问题。但没有发布任何解决方案

0 个答案:

没有答案