hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bandrm <rajivband...@gmail.com>
Subject Re: HttpClient UnAuthorized
Date Wed, 10 Feb 2010 19:51:30 GMT


Thank you for your reply. thank you for letting me know on the wire
logging...thats very good logging. 

It is accepting cookies and in the second request I could see that the same
cookie is being sent back. Even then it doesn't work. 

Now, if cookies were a problem then I guess we would have had this problem
with one server itself, right? But, it works absolutely fine with one server
up, but when I send the same request when two server instances are up then
it craps out. 

Another question, do i have use the same postMethod object in the second
call as in the first call, which is authentication? After I get
authenticated in the first call, I do postMethod.releaseConnection(), but
keep the HttpClient object intact, and for the second call I create a fresh
postMethod. Is this correct behavior?


olegk wrote:
> 
> On Wed, 2010-02-10 at 04:17 -0800, bandrm wrote:
>> Hi, 
>> 
>> I am working on a Restful Webservices client using https. Here are the
>> steps
>> I follow.... 
>> 
>> a) I create a HTTPClient, set the NameValuePair with action, username,
>> password tokens as j_security_check, j_username, j_password for
>> authentication. I create the PostMethod and make the authentication call.
>> b) Server authenticates successfully and I get back statuscode = 200. 
>> c) Now, I releaseConnection PostMethod, and create a new PostMethod for
>> the
>> second request, but with the same authenticated HTTPClient object. 
>> d) Second postmethod is the actual restful webservice call for the data. 
>> 
>> Now, second call successfully works and returns correct results when
>> there
>> is only one server running on the webservices provider end. But, when the
>> provider brings up two servers, then the second call returns unauthorized
>> or
>> it fails at the first call itself returning statuscode = 400. 
>> 
>> I am thinking the provider has some load balancer running before the two
>> servers. So, I need some kind of sticky session at the load balancer so
>> that
>> the second is routed to the same server as the first. Is this correct? Or
>> Am
>> I goofing up somewhere in my HTTP Client code.
>> 
>> I would really appreciate any clues to resolve this issue.
>> 
>> Thank you.
> 
> See if HttpClient rejects any cookies. Activate HttpClient wire logging
> in order to see the exact composition of HTTP messages generated by
> HttpClient.
> 
> Oleg
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
> For additional commands, e-mail: httpclient-users-help@hc.apache.org
> 
> 
> 

-- 
View this message in context: http://old.nabble.com/HttpClient-UnAuthorized-tp27530313p27536990.html
Sent from the HttpClient-User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org


Mime
View raw message