java webservice client 超时设置

CXF
https://cxf.apache.org/docs/client-http-transport-including-ssl-support.html
//Turn off chunking so that NTLM can occur
Client client = ClientProxy.getClient(port);
HTTPConduit http = (HTTPConduit) client.getConduit();
HTTPClientPolicy httpClientPolicy = new HTTPClientPolicy();
httpClientPolicy.setConnectionTimeout(36000);
httpClientPolicy.setAllowChunking(false);
http.setClient(httpClientPolicy);


JAX-WS client timeout

CVHandlerImplService ss = new CVHandlerImplService(wsdlURL, SERVICE_NAME);
        
        CVHandlerImplPortType port = ss.getCVHandlerImplPort();
        Map<String, Object> requestContext = ((BindingProvider)port).getRequestContext();
        requestContext.put("com.sun.xml.internal.ws.connect.timeout", 5000); // Timeout in millis
        requestContext.put("com.sun.xml.internal.ws.request.timeout", 5000); // Timeout in millis

你可能感兴趣的:(webservice)