修改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
((BindingProvider) wsPort).getRequestContext().put("com.sun.xml.ws.request.timeout", 3 * 60 * 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.

share | 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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值