Is there anyway to get a method added .getRequestBodyAsString() to the Post Class that allows us to look at the post request body in the same way the we can look at the response body using the .getResponseBodyAsString() method for the GetMethod() class. It would sure help with debugging.
-----Original Message----- From: Gerdes, Tom [mailto:[EMAIL PROTECTED] Sent: Thursday, January 05, 2006 3:31 PM To: HttpClient Project Subject: RE: Post Method - Content Length Header This did work I was able continue after the Post operation. The server is described in the response headers as: Server: Microsoft-IIS/5.0 Date: Thu, 05 Jan 2006 19:43:20 GMT X-Powered-By: ASP.NET X-AspNet-Version: 1.1.4322 -----Original Message----- From: Oleg Kalnichevski [mailto:[EMAIL PROTECTED] Sent: Thursday, January 05, 2006 3:13 PM To: HttpClient Project Subject: Re: Post Method - Content Length Header Gerdes, Tom wrote: > Is this correct for setting the stale connection check to disabled: > No. This is not. HttpClient theclient = new HttpClient(); theclient.getHttpConnectionManager().getParams(). setStaleCheckingEnabled( false ); > HttpClient theclient = new HttpClient(); > > HttpState httpstate = new HttpState(); > theclient.setState(httpstate); > > HostConfiguration hostConfiguration = new HostConfiguration(); > hostConfiguration.setHost(host, port); > theclient.setHostConfiguration(hostConfiguration); > HttpConnection conn = new HttpConnection(hostConfiguration); > > HttpConnectionParams params = conn.getParams(); > params.setConnectionTimeout( 60000 ); > params.setSoTimeout( 60000 ); > params.setStaleCheckingEnabled( false ); > You are using not using HttpConnection to execute HTTP methods, are you? Oleg > > -----Original Message----- > From: Oleg Kalnichevski [mailto:[EMAIL PROTECTED] > Sent: Thursday, January 05, 2006 1:41 PM > To: HttpClient Project > Subject: Re: Post Method - Content Length Header > > Gerdes, Tom wrote: > >>I use the simplelog. I have never been able to get the wire version > > of > >>the log to work on the IBM Iseries JVM. Do you know of anyone who > > has. > > > Tom, > > (1) Are you running you code inside the Websphere app server or as a > standalone application? If latter is the case, the simple log should > work just fine with any JVM type. Just make sure the console output is > not redirected to a file > > (2) > > >>java.io.InterruptedIOException: Read timed out > > What makes you think this has anything to do with the Content-Length > header? > > (3) Consider disabling the so called stale connection check and see if > that makes any difference > > http://jakarta.apache.org/commons/httpclient/performance.html#Stale%20co > nnection%20check > > (4) What is the target HTTP server? What protocol version does it > support? > > Oleg > > >>-----Original Message----- >>From: Oleg Kalnichevski [mailto:[EMAIL PROTECTED] >>Sent: Thursday, January 05, 2006 11:18 AM >>To: Gerdes, Tom >>Subject: Re: Post Method - Content Length Header >> >>On Thu, Jan 05, 2006 at 11:11:30AM -0600, Gerdes, Tom wrote: >> >> >>>I working on an IBM Iseries. I am not sure how to product a >>>wire/context log of the http session. I have provided a trace that >>>includes the end of the trace of the http session. I have also >> >>included >> >> >>>a snippet of the source code. . Thanks! >>> >>> >>> >>>>>On Thu, Jan 05, 2006 at 10:00:38AM -0600, Gerdes, Tom wrote: >>>>>I am trying to execute a Post method. I keep getting "read time >>> >>>out" >>> >>> >>>>>errors because I am not including the "Content Length" request >>> >>>header. >>> >>> >>>>>How can I get the length of the request so that I can add the >>>>>appropriate request header. The only method to do this I could >> >>find >> >> >>>is >>> >>> >>>>>in the EntityEnclosingMethod and it is protected so I can not use >> >>it >> >> >>>>>directly in my class. >>>> >>>>Please produce a wire/context log of the HTTP session. A code snippet >>>>might helps as well >>> >>Tom, please send your posts to tne mailing list. Do not write to me >>directly >> >>This is how you should go about generating the wire log >> >>http://jakarta.apache.org/commons/httpclient/logging.html >> >>Oleg >> >> >> >>>Here is the trace information: >>> >>>java.io.InterruptedIOException: Read timed out >>> at java.lang.Throwable.<init>(Throwable.java:195) >>> at java.lang.Exception.<init>(Exception.java:41) >>> at java.io.IOException.<init>(IOException.java:40) >>> at >>>java.io.InterruptedIOException.<init>(InterruptedIOException.java:45) >>> at >>> >> >> > com.ibm.as400.ibmonly.net.ssl.SSLSocketImpl.read(SSLSocketImpl.java:652) > >>> at >>> >> >> > com.ibm.as400.ibmonly.net.ssl.SSLInputStream.read(SSLInputStream.java:13 > >>>3) >>> at >>>java.io.BufferedInputStream.fill(BufferedInputStream.java:183) >>> at >>>java.io.BufferedInputStream.read(BufferedInputStream.java:201) >>> at >>> >> >> > org.apache.commons.httpclient.HttpConnection.isStale(HttpConnection.java > >>>:505) >>> at >>> >> >> > org.apache.commons.httpclient.HttpConnection.closeIfStale(HttpConnection > >>>.java:430) >>> at >>> >> >> > org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMe > >>>thodDirector.java:381) >>> at >>> >> >> > org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMetho > >>>dDirector.java:170) >>> at >>> >> >> > org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:3 > >>>96) >>> at >>> >> >> > org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:3 > >>>24) >>> at BANKMIJ.main(BANKMIJ.java:150) >>>Read timed out >>> >>> >>>Here is a snippet of the source code: >>> >>> PostMethod post1 = new >>> >> >> > PostMethod("https://miwebcombank.ebanking-services.com/Nubi/signin.aspx" > >>>); >>> post1.addParameter("__VIEWSTATE", viewstate); >>> post1.addParameter("vtbCompanyId", CompanyID); >>> post1.addParameter("vtbUserId", UserID); >>> post1.addParameter("vtbPassword", Password); >>> post1.addParameter("btnSubmit", "Sign In"); >>> post1.setRequestHeader("Accept", "image/gif, image/x-xbitmap, >>>image/jpeg, image/pjpeg, application/x-shockwave-flash, >>>application/vnd.ms-excel, application/vnd.ms-powerpoint, >>>application/msword, */*"); >>> post1.setRequestHeader("Referer", >>>"https://miwebcombank.ebanking-services.com/Nubi/signin.aspx"); >>> post1.setRequestHeader("Accept-Language", "en-us"); >>> post1.setRequestHeader("Content-Type", >>>"application/x-www-form-urlencoded"); >>> post1.setRequestHeader("Accept-Encoding", "gzip, deflate"); >>> post1.setRequestHeader("User-Agent", "Mozilla/4.0 (compatible; MSIE >>>6.0; Windows NT 5.1; .NET CLR 1.0.3705; .NET CLR 1.1.4322)"); >>> post1.setRequestHeader("Host", >> >>"miwebcombank.ebanking-services.com"); >> >> >>> post1.setRequestHeader("Connection", "Keep-Alive"); >>> try { theclient.executeMethod(post1); } >>> catch (HttpException he) >>> { he.printStackTrace(System.out); >>> System.err.println(he.getMessage().toString()); >>> ErrorMessageText = he.getMessage().toString(); >>> Email.send(EmailServer, ReplyToEmail, EmailForError, "", "", "M&I >>>Bank Minneapolis - Positive Pay Error!", "Error Sending User Name and >>>Password to web site >>>https://miwebcombank.ebanking-services.com/Nubi/signin.aspx Method >>>post1 in BANKMIJ failed! Here is the error Message: " + >>>ErrorMessageText, "", ntUserName, ntPassword, ReplyToEmail, ""); >>> BANKMIJ.logoff(theclient, EmailServer, EmailForError, ntUserName, >>>ntPassword, ReplyToEmail); >>> } >>> catch (IOException ie) >>> { ie.printStackTrace(System.out); >>> System.err.println(ie.getMessage().toString()); >>> ErrorMessageText = ie.getMessage().toString(); >>> Email.send(EmailServer, ReplyToEmail, EmailForError, "", "", "M&I >>>Bank Minneapolis - Positive Pay Error!", "Error Sending User Name and >>>Password to web site >>>https://miwebcombank.ebanking-services.com/Nubi/signin.aspx Method >>>post1 in BANKMIJ failed! Here is the error Message: " + >>>ErrorMessageText, "", ntUserName, ntPassword, ReplyToEmail, ""); >>> //BANKMIJ.logoff(theclient, EmailServer, EmailForError, >> >>ntUserName, >> >> >>>ntPassword, ReplyToEmail); >>> } >>> >>> >> >> >>--------------------------------------------------------------------- >>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] > > > --------------------------------------------------------------------- > 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] --------------------------------------------------------------------- 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]
