hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Thandra, Kiran" <Extern.Kiran.Than...@vw.com>
Subject RE: Slide and Jakarta-commons-httpClient
Date Tue, 10 Dec 2002 16:29:41 GMT
Iam very thank full for all your suggestions 
Iam using the Release 2.0 Alpha 1 - 5 October 2001 . What is the latest
version i need to use.


Regards,
Kiran Thandra

-----Original Message-----
From: Eric Johnson [mailto:eric@tibco.com]
Sent: Tuesday, December 10, 2002 11:21 AM
To: Commons HttpClient Project
Subject: Re: Slide and Jakarta-commons-httpClient


Thandra,

If nothing else, you might want to change your code to call 
client.methodExcute(), instead of calling method.execute() directly, 
which is significantly trickier.  I admit that I did not look for other 
problems in your sample snippet, though, so that might not be your only 
issue.

It is also unclear to me whether you are using the latest daily build of 
HttpClient, or the last "public" release which is over a year old.  That 
might make a difference.

-Eric.

Thandra, Kiran wrote:

>Hello ,
>
>Need some help with using Http Client. Iam new to this technology
.Basically
>we are trying to post some form data and get to a internet site and get the
>response back.Iam getting error 405 method not allowed.I was successfully
>post this data using Innovation Http Client Api and java.net.Some times its
>taking lot time to execute this request.
>
>I think not properly using the API.
>
>Any Suggestions are greately appreciated
>
>MY CODE:
>
>org.apache.commons.httpclient.HttpClient client=new
>org.apache.commons.httpclient.HttpClient();
>
>java.net.URL url=new java.net.URL("http://xyz.abc.com");         
>client.startSession(url);
>System.out.println("session started");
>   org.apache.commons.httpclient.methods.PostMethod method = new
>org.apache.commons.httpclient.methods.PostMethod("/verifyuser.asp");
>   org.apache.commons.httpclient.NameValuePair form_data[] = new
>org.apache.commons.httpclient.NameValuePair[2];
>     
>            form_data[0] = new
>org.apache.commons.httpclient.NameValuePair("uid", "2");
>		    form_data[1] = new
>org.apache.commons.httpclient.NameValuePair("pwd","55455545");
>		    
>//org.apache.commons.httpclient.HttpState st=;
>
>//System.out.println(st);
>         
>         //method.addRequestHeader("Expect","100-continue");     
>         method.setFollowRedirects(false);                   
>         method.setQueryString(form_data);
>         method.setUseDisk(false);
>        
>    
>         
>           try{
>                method.execute(new
>org.apache.commons.httpclient.HttpState(),conn);
>                 int i=client.executeMethod(method);
>            
>         java.io.BufferedReader in = new java.io.BufferedReader(new
>java.io.InputStreamReader
>        (method.getResponseBodyAsStream()));
>         
>  	   while ((line = in.readLine()) != null) {
>  			System.out.println(line);
>  	   }
>
>  
>      }catch(Throwable t){
>            t.printStackTrace();
>
>         }  
>
>Regards,
>Kiran Thandra
>
>  
>


--
To unsubscribe, e-mail:
<mailto:commons-httpclient-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail:
<mailto:commons-httpclient-dev-help@jakarta.apache.org>

Mime
View raw message