retracile
retracile

Reputation: 12339

HTTP connection reuse in 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?

(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.)

Upvotes: 2

Views: 10376

Answers (2)

Daniel Bimschas
Daniel Bimschas

Reputation: 41

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.

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.

Cheers, Daniel

Upvotes: 4

Daniel Bimschas
Daniel Bimschas

Reputation: 111

According to the Metro JAX-WS Guide you just need to set the Java environment variable http.keepAlive to true.

Upvotes: 2

Related Questions