-----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]