The following records common webservice timeout configuration
1 CXF
Client client = ClientProxy.getClient(port);
HTTPConduit http = (HTTPConduit) client.getConduit();
HTTPClientPolicy httpClientPolicy = new HTTPClientPolicy();
// 设置连接超时
httpClientPolicy.setConnectionTimeout(6*1000);
httpClientPolicy.setAllowChunking(false);
http.setClient(httpClientPolicy);
2、jax-ws
ServiceReceivePidService serviceReceivePidService = new ServiceReceivePidService();
ServiceReceivePid serviceReceivePid = serviceReceivePidService.getServiceReceivePid();
((BindingProvider)serviceReceivePid).getRequestContext().put("com.sun.xml.internal.ws.connect.timeout", 6*1000);
((BindingProvider)serviceReceivePid).getRequestContext().put("com.sun.xml.internal.ws.request.timeout", 6*1000);
com.sun.xml.internal.ws.connect.timeout: Connection Timeout
com.sun.xml.internal.ws.request.timeout: Request Timeout
In milliseconds. If no timeout or corresponding to the specified timeout 0 is expressed never time out;