On Fri, Jan 15, 2010 at 10:48 PM, tislam <[email protected]> wrote:
>
> Hello Again,
> I must say that I was disheartened to not get any response from anyone.
> While I continued my painful "debugging" journey, I found the solution that
> worked for me. It is basically Amila's suggested solution with a caveat for
> my situation. For some unknown reason, the following options did not work:
>
> options.setProperty(HTTPConstants.REUSE_HTTP_CLIENT, true);
> options.setProperty(HTTPConstants.CACHED_HTTP_CLIENT,
> this.httpClient);
>
> I had to set these options to the configuration context instead:
>
> ConfigurationContext context =
> this.client.getServiceContext().getConfigurationContext();
> context.setProperty(HTTPConstants.REUSE_HTTP_CLIENT, true);
> context.setProperty(HTTPConstants.CACHED_HTTP_CLIENT,
> this.httpClient);
> context.setProperty(HTTPConstants.AUTO_RELEASE_CONNECTION, true);
>
> It baffles me as to why the former did not work for me as it worked for
> most people (as I found on google). I wish someone can explain to me some
> logical reason for this. I wasted a couple of days pondering why it didn't
> work. But at the end, it all worked out for.
>
My suggestion basically tested with Axis2 1.5 and there were some changes to
http transport (Done by Glen)
in Axis2 1.5.1.
Axis2 1.5.1 keeps an one cached http client object in the configuration
context. Since default Multithreaded connection manager allows only two
connections there is a problem if some one try to use more than two
connections with out releasing used ones.
that is why Deepal has asked to cleanUp the transport.
But anyway you can not use three simultaneous connections with Axis2 1.5.1.
The only way to do that is to set a Httpclient as follows,
ConfigurationContext configurationContext =
ConfigurationContextFactory.createConfigurationContextFromFileSystem(
AXIS2_REPOSITORY_LOCATION,
AXIS2_CLIENT_CONFIG_FILE);
MultiThreadedHttpConnectionManager
multiThreadedHttpConnectionManager = new
MultiThreadedHttpConnectionManager();
HttpConnectionManagerParams params = new
HttpConnectionManagerParams();
params.setDefaultMaxConnectionsPerHost(20);
multiThreadedHttpConnectionManager.setParams(params);
HttpClient httpClient = new
HttpClient(multiThreadedHttpConnectionManager);
configurationContext.setProperty(HTTPConstants.CACHED_HTTP_CLIENT,
httpClient);
this increase 2 to 20. can you need to call
serviceClient.cleanupTransport();
otherwise same problem comes after 20 invocations.
if you set the
context.setProperty(HTTPConstants.AUTO_RELEASE_CONNECTION, true);
I think you don't need to set any other parameter. But this builds the OM
tree once the response is received.
thanks,
Amila.
> Thanks,
> Tariq.
> --
> View this message in context:
> http://old.nabble.com/Third-web-service-invoctaion-always-throws-Timeout-Exception-tp27029690p27180475.html
> Sent from the Axis - User mailing list archive at Nabble.com.
>
>
--
Amila Suriarachchi
WSO2 Inc.
blog: http://amilachinthaka.blogspot.com/