User login

How do I setup my Axis2 generated stub to Reuse/share http connections?

Story :

Project :

Q: How do I setup my Axis2 generated stub to reuse/share http connections across several calls?

A: It's not too complicated..

TestServiceStub myStub = new TestServiceStub(wsURL);
myStub._getServiceClient().getOptions().setProperty(org.apache.axis2.transport.
http.HTTPConstants.REUSE_HTTP_CLIENT, new Boolean(true));
In fact if you need more control over the Commons HTTPClient's MultiThreadedHttpConnectionManager, you can even set it up yourself and then use the above snippet to make sure it gets used.
ConfigurationContext context = ConfigurationContextFactory.
createConfigurationContextFromFileSystem(null, null);
HttpClient httpClient = new HttpClient(new MultiThreadedHttpConnectionManager());
context.setProperty(HTTPConstants.CACHED_HTTP_CLIENT, httpClient);
For any further details or questions axis-dev@ws.apache.org (Prefix subject with with [Axis2])
4
Average: 4 (1 vote)

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

People this does not seem

People this does not seem to work.

I am trying this and maxing out with sockets in 'TIME_WAIT'.

 

Retraction

Well - if I had insured that BEFORE the very first HTTP request I had set the REUSE option it would have work.

 It is important that the options are set before making a socket request. 

Thanks. 

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.