微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

修改webservice 默认超时时间

http://stackoverflow.com/questions/3130913/setting-jax-ws-client-timeout

sun自带的webservice 超时通过 

With Metro/Glassfish...

//1 minute for connection ((BindingProvider) wsPort).getRequestContext().put("com.sun.xml.ws.connect.timeout", 1 * 60 * 1000); //3 minutos for request (("com.sun.xml.ws.request.timeout",0)">3 * 1000); 

Best regards!

share | improve this answer
 
1  
Actually that is what said in 1st answer (and in the question itself) Also maybe it makes sense to import com.sun.xml.ws.developer.JAXWSProperties and useJAXWSProperties.CONNECT_TIMEOUT and JAXWSProperties.REQUEST_TIMEOUT if someone is not afraid to couple with Sun internals. –   dma_k  Sep 29 '10 at 8:03
 
How do I get wsPort instance? –   mvmn  Feb 7 '12 at 22:06
Doesn't seem to work at all. –   Arne Evertsson  Nov 13 '12 at 15:27
Eww,string keys. Just what I should never have to see in a type-safe language. Whoever designed this API should burn in a fire. –   Trejkaz  Feb 4 at 2:17
add comment
ProxyWs proxy = (ProxyWs) factory.create(); Client client = ClientProxy.getClient(proxy); HTTPConduit http = (HTTPConduit) client.getConduit(); HTTPClientPolicy httpClientPolicy = new HTTPClientPolicy(); httpClientPolicy.setConnectionTimeout(0); httpClientPolicy.setReceiveTimeout(0); http.setClient(httpClientPolicy);

This worked for me.

| improve this answer
  add comment

If you are using a Sun JRE,you can set the following system properties for default network connect and read timeouts (in milliseconds). I haven't tried these with the JAX-WS client,but they ought work there as well:

sun.net.client.defaultConnectTimeout sun.net.client.defaultReadTimeout

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐