以下记录常用的webservice超时配置
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);
【java关于设置webservice连接超时和请求超时】com.sun.xml.internal.ws.connect.timeout:连接超时
com.sun.xml.internal.ws.request.timeout:请求超时
单位是毫秒。如果没有指定对应的超时时间或者指定的超时时间为0都表示永不超时;
推荐阅读
- Java|Java基础——数组
- 人工智能|干货!人体姿态估计与运动预测
- java简介|Java是什么(Java能用来干什么?)
- Java|规范的打印日志
- Linux|109 个实用 shell 脚本
- 程序员|【高级Java架构师系统学习】毕业一年萌新的Java大厂面经,最新整理
- Spring注解驱动第十讲--@Autowired使用
- SqlServer|sql server的UPDLOCK、HOLDLOCK试验
- jvm|【JVM】JVM08(java内存模型解析[JMM])
- 技术|为参加2021年蓝桥杯Java软件开发大学B组细心整理常见基础知识、搜索和常用算法解析例题(持续更新...)