[prev in list] [next in list] [prev in thread] [next in thread] 

List:       httpclient-users
Subject:    Re: URGENT --- Passing Session Info to a Redirected Page
From:       Oleg Kalnichevski <olegk () apache ! org>
Date:       2008-04-09 17:19:03
Message-ID: 1207761543.5805.10.camel () ubuntu
[Download RAW message or body]


On Tue, 2008-04-08 at 13:23 +0800, Shanmugam Karthikeyan NCS wrote:
> Hi All,
> 
> I am new to HttpClient. I need to develop a proxy servlet which does an internal \
> Http post to a IIS server which in turn generates a cookie which i need to use in \
> order to perform Single Sign On to a Vendor application. Currently this Single Sign \
> On is working perfectly for a form based http posting of user id and password. The \
> requirement is to use a servlet based http post instead of form based http post. 
> 
> Therefore, I decided to use HttpClient API to achieve this. 
> 
> The following is the pseduo code for your understanding
> 
> String url = "http://192.168.33.290/siteminderagent/forms/login.fcc \
> <https://webmail.ncs.com.sg/exchweb/bin/redir.asp?URL=http://192.168.33.290/siteminderagent/forms/login.fcc> \
> "; 
> HttpClient client = new HttpClient();
> 
> PostMethod postMethod = new PostMethod(url);
> 
> postMethod.addParameter("USER","skarthi");
> postMethod.addParameter("PASSWORD","pass");
> postMethod.addParameter("target","http://spectrum.skarthi.com.sg/ \
> <https://webmail.ncs.com.sg/exchweb/bin/redir.asp?URL=http://spectrum.skarthi.com.sg/> \
> "); 
> int statusCode = client.executeMethod(postMethod);
> 
> The STATUS CODE RETURNED HERE IS 302. BY RIGHT IF I USE A BROWSER TO PERFORM THIS \
> POST , THE BROWSER WILL AUTOMATICALLY REDIRECT TO http://spectrum.skarthi.com.sg/ \
> <https://webmail.ncs.com.sg/exchweb/bin/redir.asp?URL=http://spectrum.skarthi.com.sg/> \
> .  
> Since the http post is through HttpClient I think I am getting 302 status code.
> 
> Therefore , I am performing the following 
> 
> Header locationHeader = postMethod.getResponseHeader("location");
> String redirectLocation =null;
> if (locationHeader != null) {
> redirectLocation = locationHeader.getValue();
> }
> response.sendRedirect(redirectLocation );

> 
> The problem which I am facing now is that the Single Sing On is not working. For \
> the Single Sing On to work I need to pass the coookie value availble in my \
> postMethod to the URL redirected. My Question here is that .. How do I pass the \
> session info which I getting after the "executeMethod" to the redirected URL

Obviously, you need to include the session cookie

Oleg

> 
> 
> regards,
> 
> S.Karthikeyan
> 


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


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic