Kamal,

My understanding of apache's HTTPClient is that it closes HTTP
connections after each response. REUSE_HTTP_CLIENT means reusing the
client object that is performing the request/response, not necessarily
the underlying connection.

If you're trying to maintain some sort of state, such as a cookie value
from one request to the next, using the same HTTPClient will cause the
cookies from the prior reponse to be sent back to the server on
subsequent requests.

Once you receive your first response,
Axis stores the org.apache.commons.httpclient.HTTPClient instance in the
ConfigurationContext. When you create your second, and subsequent
requests, you need to use the same ConfigurationContext that was used in
the first request. 

One way to do this is to create a single ServiceClient and create an
OperationClient from it for each call.

Here's a snippet that I found works for me:
//create ServiceClient
ServiceClient sender = new ServiceClient();
OperationClient opClient =
sender.createClient(ServiceClient.ANON_OUT_IN_OP);
//set the options...
//execute the call
//capture results
...
...
//make second request using same httpclient:
* The ServiceClient maintains a reference to the ConfigurationContext
* through the ServiceContext.
* If we use a new ServiceClient to create our OperationClient,
* we will lose the information associated with the previous calls
* ConfigurationContext. Since the httpclient is stored as a property
* in the ConfigurationContext, and we want to reuse the httpclient
* from the prior request (so cookies are maintained), 
* we must hang on to the ServiceClient.
* 
* if the following line is uncommented, the we'll get a new instance of
* the underlying HTTPClient, we don't want this.
* 
*/
//sender = new ServiceClient();
OperationClient opClient2 =
sender.createClient(ServiceClient.ANON_OUT_IN_OP);
//set the options...
//execute the call
//capture results


Hope this helps. 
-Jay

-----Original Message-----
From: Kang, Kamaljeet K. [mailto:[EMAIL PROTECTED] 
Sent: Thursday, April 19, 2007 4:40 PM
To: [email protected]
Subject: REUSE_HTTP_CLIENT

Hi,

I have set REUSE_HTTP_CLIENT to 'true' in my stub but I still see from
netstat that new HTTP Connections are being created. I see connections
being reused sometimes but after 2-3 requests it creates new
connections. Do we need to do something else for persistent HTTP
connection?


Thanks

Kamal
============================================================
The information contained in this message may be privileged
and confidential and protected from disclosure. If the reader
of this message is not the intended recipient, or an employee
or agent responsible for delivering this message to the
intended recipient, you are hereby notified that any reproduction,
dissemination or distribution of this communication is strictly
prohibited. If you have received this communication in error,
please notify us immediately by replying to the message and
deleting it from your computer. Thank you. Tellabs
============================================================

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to