David,

My only guess is that the logon request (POST
/iddb3/iddb3_2/login.verify) fails due to invalid credentials or some
other reason. I see no session cookie in the response. The UserId and
pUserId cookies are too simple and may not necessarily be session
cookies.

Anyways, knowing what exactly what handshake the site expects is your
best chance. Take a look at the Ethereal

http://www.ethereal.com/download.html
 
See if you succeed in capturing the HTTP traffic between the browser and
the site using this tool. 

Cheers,

Oleg


On Sat, 2004-09-11 at 16:13, David Qain wrote:
> Oleg,
> 
> Thank you very much for your quick response. 
> 
> During manual login to the site, I captured the
> redirect URL from the java script and saved it in the
> html file.  If one browser logins already, clicking
> the saved html file will open a browser and automatic
> logins.
> 
> The returned status code from the first PostMethod is
> 200, but redirect code.  I searched the mail list and
> found some one got 200 for redirecting the website.
> 
> The log file is attached.  What traffic analyzer would
> you recommend ?  I can not install the traffic
> analyzer on the server side since it is a commercial
> web site.  Can I still install it on the client side ?
> 
> Thank you very much for your advices.
> 
> David
> 
>   
> 
> 
> --- Oleg Kalnichevski <[EMAIL PROTECTED]> wrote:
> 
> > David,
> > 
> > Just a few comments
> > 
> > (1) This is unrelated to your problem, but do make
> > sure you release
> > connection when you are done with the method. In
> > most cases HttpClient
> > will do its very best to automatically release the
> > connection, but in
> > some cases (like the response content consumed
> > partially) HttpClient
> > simply cannot know that the method and the
> > connection associated with it
> > are not longer needed.
> > 
> > The general pattern should always be
> > 
> > HttpMethod httpmethod = new GetMethod("/whatever");
> > try {
> >   httpclient.executeMethod(httpmethod);
> >   // do stuff. 
> > } finally {
> >   httpmethod.releaseConnection();
> > }
> > 
> > This can save you A LOT of grief should you decide
> > to use HttpClient
> > with a multi-threaded connection manager or if some
> > of your methods do
> > not consume the response content in its entirety
> > 
> > For details see the tutorial:
> > 
> >
> http://jakarta.apache.org/commons/httpclient/tutorial.html
> > 
> > (2) As to the main issue, apparently the redirect
> > URL is invalid. I
> > could possibly say more if I had the log, but the
> > log you attached to
> > your previous message did not get through. Try
> > attaching the log inline
> > or send it to me directly
> > 
> > Another idea would be to capture the exact
> > transaction between and the
> > browser and the site using a traffic analyzer and
> > then implement the
> > same logic with HttpClient
> > 
> > Hope this helps
> > 
> > 
> > Oleg
> > 
> > 
> > On Sat, 2004-09-11 at 03:59, David Qain wrote:
> > > Hello,
> > > 
> > > I am new to HttpClient.  I tried to follow
> > > FormLoginDemo to log in the a web site.  After
> > > entering the user name and password, the site is
> > > redirected to a new url using the javascript.  The
> > > program uses the PostMethod to login to the web
> > site
> > > successfully since the cookies are created.  But
> > it
> > > can not use GetMethod to redirect to the page
> > using
> > > the URL from returned javascript.  The "HTTP/1.1
> > 404
> > > Not Found" was found in the log file.  But I was
> > able
> > > to login the web site using the re-direct URL from
> > > javascripts using the web browser.  Here are part
> > of
> > > codes:
> > > 
> > >  static final String LOGON_SITE = "www.iddb.com";
> > >  static final int    LOGON_PORT = 80;
> > > 
> > >         HttpClient client = new HttpClient();
> > >        
> > > client.getHostConfiguration().setHost(LOGON_SITE,
> > > LOGON_PORT, "http");
> > >        
> > >
> >
> client.getParams().setCookiePolicy(CookiePolicy.BROWSER_COMPATIBILITY);
> > >         
> > >         PostMethod authpost = new
> > > PostMethod("/iddb3/iddb3_2/login.verify");
> > >         // Prepare login parameters
> > >         NameValuePair userid   = new
> > > NameValuePair("username_in", "user");
> > >         NameValuePair password = new
> > > NameValuePair("password_in", "password");
> > >         NameValuePair autologin = new
> > > NameValuePair("autologin", "Y");
> > >         NameValuePair i_login = new
> > > NameValuePair("i_login", "Y");
> > >            
> > >         authpost.setRequestBody( 
> > >           new NameValuePair[] { userid, password,
> > > autologin, i_login});
> > >  
> > >         int statuscode2 =
> > > client.executeMethod(authpost);
> > > 
> > >         GetMethod redirect1 = new
> > >
> >
> GetMethod("/iddb3/iddb3_2/alerts.get_alert?v_alert_type=Drug&v_clear_trail=Y
> > > ");
> > >         
> > >         c1.executeMethod(redirect1 );
> > > 
> > > The log file is attached.
> > > 
> > > Thank you very much for your help !
> > > 
> > > David
> > > 
> > > 
> > > 
> > >   
> > >           
> > > __________________________________
> > > Do you Yahoo!?
> > > New and Improved Yahoo! Mail - 100MB free storage!
> > > http://promotions.yahoo.com/new_mail
> > > 
> > >
> >
> ______________________________________________________________________
> > >
> >
> ---------------------------------------------------------------------
> > > 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]
> > 
> > 
> 
> 
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection around 
> http://mail.yahoo.com


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

Reply via email to