You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Adrian Sutton <Ad...@Ephox.com> on 2003/05/22 06:30:24 UTC

[httpclient] RE: HttpClient no response

Hi Eric,
You'll need to provide some extra information before I can help you.  I'd
suggest you read through the appropriate sections of the user manual at
http://jakarta.apache.org/commons/httpclient and in particular the tutorial
(http://jakarta.apache.org/commons/httpclient/tutorial.html) and the trouble
shooting guide
(http://jakarta.apache.org/commons/httpclient/troubleshooting.html).  If
after that you still have problems, please provide the information gleaned
from the trouble shooting guide in a post to the list (also prefix the
subject with [httpclient] so people's filters pick it up).

The wire trace log is particularly useful and instructions can be found at
http://jakarta.apache.org/commons/httpclient/logging.html in almost any
problem with HttpClient the log is required before we can help at all.  In
your case, since you have provided partial code, it would be useful to
include the output since it's obviously not possible for us to run the code
itself (because it's incomplete), including this output in the log file
would be best.

Regards,

Adrian Sutton, Software Engineer
Ephox Corporation
www.ephox.com 

-----Original Message-----
From: Eric Chow [mailto:echow@macaucabletv.com]
Sent: Thursday, 22 May 2003 2:21 PM
To: commons-user@jakarta.apache.org
Subject: HttpClient no response


Hello,

When I tried to post some data to a web site, it always return no response
just "null".

But if I use the same URL in browser, it showed some content in the browser.


Eric


------------------------------------
NameValuePair nv[] = new NameValuePair[35];


      nv[0] = new NameValuePair("wv_booking_date", d);
      nv[1] = new NameValuePair("wv_booking_place", "PAV");
      nv[2] = new NameValuePair("wv_booking_time_from", "14");
      nv[3] = new NameValuePair("wv_booking_time_to", "15");
      nv[4] = new NameValuePair("wv_booking_light", "Y");
      //nv[5] = new NameValuePair("chk_booking_light", "on");
      nv[5] = new NameValuePair("wv_booking_air", "N");
      //nv[7] = new NameValuePair("chk_booking_air", "on");
      nv[6] = new NameValuePair("wv_booking_facilities", "xxx");

      nv[7] = new NameValuePair("wv_booking_date", "");
      nv[8] = new NameValuePair("wv_booking_place", "");
      nv[9] = new NameValuePair("wv_booking_time_from", "");
      nv[10] = new NameValuePair("wv_booking_time_to", "");
      nv[11] = new NameValuePair("wv_booking_light", "");
      nv[12] = new NameValuePair("wv_booking_air", "");
      nv[13] = new NameValuePair("wv_booking_facilities", "");

      nv[14] = new NameValuePair("wv_booking_date", "");
      nv[15] = new NameValuePair("wv_booking_place", "");
      nv[16] = new NameValuePair("wv_booking_time_from", "");
      nv[17] = new NameValuePair("wv_booking_time_to", "");
      nv[18] = new NameValuePair("wv_booking_light", "");
      nv[19] = new NameValuePair("wv_booking_air", "");
      nv[20] = new NameValuePair("wv_booking_facilities", "");

      nv[21] = new NameValuePair("wv_booking_date", "");
      nv[22] = new NameValuePair("wv_booking_place", "");
      nv[23] = new NameValuePair("wv_booking_time_from", "");
      nv[24] = new NameValuePair("wv_booking_time_to", "");
      nv[25] = new NameValuePair("wv_booking_light", "");
      nv[26] = new NameValuePair("wv_booking_air", "");
      nv[27] = new NameValuePair("wv_booking_facilities", "");


      nv[28] = new NameValuePair("wv_booking_date", "");
      nv[29] = new NameValuePair("wv_booking_place", "");
      nv[30] = new NameValuePair("wv_booking_time_from", "");
      nv[31] = new NameValuePair("wv_booking_time_to", "");
      nv[32] = new NameValuePair("wv_booking_light", "");
      nv[33] = new NameValuePair("wv_booking_air", "");
      nv[34] = new NameValuePair("wv_booking_facilities", "");



      PostMethod pMethod = new PostMethod(bookAction);

      pMethod.setRequestBody(nv);
      client.executeMethod(pMethod);


      String s = pMethod.getResponseBodyAsString();

      System.out.println(pMethod.getStatusLine().toString());

      System.out.println(s);

     pMethod.releaseConnection();




----------------------------------

==========================
If you know what you are doing,
it is not called RESEARCH!
==========================


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org