JAX-WS中的HTTP连接重用 [英] HTTP connection reuse in JAX-WS

查看:119
本文介绍了JAX-WS中的HTTP连接重用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用JAX-WS时如何启用HTTP连接重用?使用AXIS2时,我们在客户端存根的选项中设置org.apache.axis2.transport.http.HTTPConstants.REUSE_HTTP_CLIENT属性. JAX-WS的等效功能是什么?

How do you enable HTTP connection reuse when using JAX-WS? When we were using AXIS2, we set the org.apache.axis2.transport.http.HTTPConstants.REUSE_HTTP_CLIENT property in the client stub's options. What is the equivalent for JAX-WS?

(我已经确认我们正在为每个Web服务调用创建一个新的TCP连接.看来我们在创建新的TCP连接之前会立即断开以前的连接.)

(I have verified that we are creating a new TCP connection for each web service call. It appears we tear down the previous connection immediately before creating that new TCP connection.)

推荐答案

当我也遇到该问题时,我也对其进行了更深入的研究.似乎当前(JDK 6)版本没有正确使用http.keepAlive属性,即使《指南》(请参阅我的上一篇文章)是这样说的,因此也不会在对同一客户端的多次调用中重复使用HTTP(TCP)连接.然后,我发现了此错误报告,证实了我的怀疑.根据错误报告,您必须将JAX-WS RI(又称为Metro)实现更新为> = 2.1.2.

As I suffered from that issue, too, I've dug deeper into it. It seemed the current (JDK 6) version does not use the http.keepAlive property correctly even though the Guide (see my last post) says so, thereby not reusing HTTP (TCP) connections for multiple calls to the same client. Then, I found this bug report, confirming my suspicions. According to the bug report you'll have to update your JAX-WS RI (aka Metro) implementation to >= 2.1.2.

如果更新到最新版本(在撰写本文时为2.2.1),则可能必须使用认可的标准替代机制,以使JRE运行正确(新)版本的库.这是因为JAX-WS RI 2.2基于JAX-WS 2.2 API,但是当前的JDK/JRE版本仅提供2.1.

If you update to the newest version (which is 2.2.1 at the time of writing this) you may have to use the endorsed standards override mechanism to have the JRE running with the correct (new) version of the libraries. This is because JAX-WS RI 2.2 is based on the JAX-WS 2.2 APIs, but only 2.1 is delivered with the current JDK/JRE version.

干杯,丹尼尔

这篇关于JAX-WS中的HTTP连接重用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆