Return-Path: Mailing-List: contact commons-user-help@jakarta.apache.org; run by ezmlm Delivered-To: mailing list commons-user@jakarta.apache.org Received: (qmail 40644 invoked from network); 20 Mar 2003 23:41:15 -0000 Received: from unknown (HELO BIGCOW.intraephox.ephox.com) (202.138.204.102) by daedalus.apache.org with SMTP; 20 Mar 2003 23:41:15 -0000 Received: by BIGCOW.intraephox.ephox.com with Internet Mail Service (5.5.2656.59) id ; Fri, 21 Mar 2003 09:41:21 +1000 Message-ID: <0AC2D75550100F4DBDB025D4D05611887704D3@BIGCOW.intraephox.ephox.com> From: Adrian Sutton To: 'Jakarta Commons Users List' Subject: RE: [HttpClient] sample code for form post Date: Fri, 21 Mar 2003 09:41:18 +1000 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2656.59) Content-Type: text/plain; charset="iso-8859-1" X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N Hi, You should never be getting a 100 continue response from HttpClient - we should ignore it for you. This sounds like a bug that was recently fixed in CVS. Could you try grabbing the latest nightly build and seeing if the problem still exists with that? If not there are some troubleshooting tips at http://jakarta.apache.org/commons/httpclient/troubleshooting.html - if you could run through those and send through whatever information you find out it would be good. Also, providing a wire trace would help a lot as well - instructions are at http://jakarta.apache.org/commons/httpclient/logging.html Let me know how it goes... Adrian Sutton, Software Engineer Ephox Corporation www.ephox.com -----Original Message----- From: Donie Kelly [mailto:donie.kelly@tecnomen.ie] Sent: Friday, 21 March 2003 4:28 AM To: 'Jakarta Commons Users List' Subject: RE: [HttpClient] sample code for form post Try reading the response again when you get 100 continue. This is not the final response from the server, it just means that you can continue. Some servers always send this response no matter what happens. You need to ignore it. Donie -----Original Message----- From: Greg Dunn [mailto:greg.dunn@nisc.cc] Sent: 20 March 2003 18:14 To: Jakarta Commons Users List Subject: RE: [HttpClient] sample code for form post I need to post a set of form values to an authorization service. I couldn't locate any example code that does this, does anyone know where I could find some? My initial attempts have been thwarted by the server's returning an HTTP 100 - Continue response. This is the relevant part of what I have via trial and much error: try { HttpClient client = new HttpClient(); client.setConnectionTimeout(5000); PostMethod post = new PostMethod(paymentServerURL); post.setFollowRedirects(false); post.setStrictMode(true); post.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); // Add the form values NameValuePair[] data = { new NameValuePair("x_First_Name", x_First_Name), new NameValuePair("x_Last_Name", x_Last_Name), new NameValuePair("x_Card_Num", x_Card_Num), new NameValuePair("x_Exp_Date", x_Exp_Date) }; post.setRequestBody(data); client.executeMethod(post); try { responseContent = post.getResponseBodyAsString(); } catch (NullPointerException e) { // do graceful stuff } responseCode = post.getStatusCode(); responseMess = post.getStatusText(); if (responseCode != 200) { // do graceful stuff } post.releaseConnection(); } catch (MoreExceptions me) { // do graceful stuff } Greg --------------------------------------------------------------------- To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org For additional commands, e-mail: commons-user-help@jakarta.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org For additional commands, e-mail: commons-user-help@jakarta.apache.org