我正在尝试为 JAX WS 和 Http Post 调用设置连接和请求超时。我的代码有效,但最多只有 20 秒。也就是我可以把超时值改成5秒,2秒就可以了,但是把超时值设置成30秒会在20秒超时,把超时值设置成60秒还是会在20秒超时。有谁知道最多 20 秒设置在哪里?
对于 JAXWS:
//This works, timed out in 10 seconds
((BindingProvider) soapPort).getRequestContext().put(JAXWSProperties.CONNECT_TIMEOUT, 10000);
// This would time out in 20 seconds!!!
((BindingProvider) soapPort).getRequestContext().put(JAXWSProperties.CONNECT_TIMEOUT, 60000);`
对于 Http:
// This works, timed out in 10 seconds
HttpConnectionParams.setConnectionTimeout(params, 10000);
// This would time out in 20 seconds!!!
HttpConnectionParams.setConnectionTimeout(params, 50000);