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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to