On Nov 19, 2007 4:40 PM, terry_513 <[EMAIL PROTECTED]> wrote: > > > Hello, > > I am new on this site, in need of help. Hope you experts will help a > beginner. > > I am developing an application where, I have to login to web site, etc > programmatically. I can access the web page, retreive the page. So, GET > part > is working fine. I have problem with Post. I am using JDK > 1.6 with apache's HttpClient 3.1 for communicating through the web site. > After setting parameters in NameValuePair[], when i run > execuseMethod(postMethod), it throws the following exception : > > i]Exception in thread "AWT-EventQueue-0" > java.lang.IllegalArgumentException: > host parameter is null
This is Java Swing API error, please check that part of your code. In case that doesnt solve the problem, please full exception trace. > > I think, I may be going wrong in providing proper headers, parameters, > etc. Can anyone help me know: > > 1. How to implement log in my application. I think that will help me know > the headers & all erros & exceptions.I tried a lot, but couldn't implement > the Logging, if any one can guide me for that , would be great. http://jakarta.apache.org/httpcomponents/httpclient-3.x/logging.html > > 2. How can I know what parameters, I need to pass in the POST method. > Along > with form attributes, their may be any hidden values to be passed. How can > I > find out that. You can use things like wireshark http://www.wireshark.org/ to analyze what parameters are being sent. > > 3. Their is a submit button, how do i deal with that - tell the post > method > to click it ? Submit Button click - posts parameters, maybe after doing some javascript. client.executeMethod(post) - posts parameters For a Web server it doesnt matter how the parameteres come in, their values matter. Please read here for httpclient's intended purpose http://wiki.apache.org/jakarta-httpclient/ForAbsoluteBeginners -- Puneet http://sahyog.blogspot.com/
