[EMAIL PROTECTED] wrote:
In a message dated 1/15/2006 2:53:51 P.M. Eastern Standard Time,
[EMAIL PROTECTED] writes:
I looked at your code and spotted something that does not look right to me
// Create a PostMethod method instance.
PostMethod method = new PostMethod(url);
NameValuePair[] data = {
new NameValuePair("username", "xxxxxxx"),
new NameValuePair("password", "yyyyyy")
};
You do not seem to be using the 'data' object anywhere in your code.
Make sure you assign these name value pairs to your POST method as form
parameters.
I amended my original code as the following snippet shows:
// Create a PostMethod method instance.
PostMethod method = new PostMethod(url);
NameValuePair[] data = {
new NameValuePair("username", "xxxxxxx"),
new NameValuePair("password", "yyyyyyy")
};
method.addParameters(data);
try {
// Execute the method.
int statusCode = client.executeMethod(method);
et cetera
I am still getting the Logon page in the responseBody. Here is the listing
from the logger:
Jerry,
Interestingly enough, the server sends back a session cookie, which
seems to suggest that the authentication was successful. Does the server
use the J2EE Form-based Authentication or some sort of home-grown
authentication model?
> Cookie accepted:
> "$Version=0; JSESSIONID=0001vfSuxGyOWuZ8mvrie73okQV:10hc91i5j; $Path=/"
Oleg
2006/01/15 15:09:48:750 EST [DEBUG] HttpClient - Java version: 1.5.0_06
2006/01/15 15:09:48:750 EST [DEBUG] HttpClient - Java vendor: Sun
Microsystems Inc.
2006/01/15 15:09:48:750 EST [DEBUG] HttpClient - Java class path:
.;c:\JavaApps\;c:\WebSiteTest\;c:\JavaApps\jCookie-0.8b\classes\;c:\JavaApps\commons-log
ging-1.0.5\;c:\JavaApps\commons-httpclient-3.0\;c:\JavaApps\commons-codec-1.3\
;c:\JavaApps\junit3.8.1\;
2006/01/15 15:09:48:750 EST [DEBUG] HttpClient - Operating system name:
Windows XP
2006/01/15 15:09:48:750 EST [DEBUG] HttpClient - Operating system
architecture: x86
2006/01/15 15:09:48:750 EST [DEBUG] HttpClient - Operating system version:
5.1
2006/01/15 15:09:48:921 EST [DEBUG] HttpClient - SUN 1.5: SUN (DSA
key/parameter generation; DSA signing; SHA-1, MD5 digests; SecureRandom; X.509
certificates; JKS keystore; PKIX CertPathValidator; PKIX CertPathBuilder; LDAP,
Collection CertStores)
2006/01/15 15:09:48:921 EST [DEBUG] HttpClient - SunRsaSign 1.5: Sun RSA
signature provider
2006/01/15 15:09:48:921 EST [DEBUG] HttpClient - SunJSSE 1.5: Sun JSSE
provider(PKCS12, SunX509 key/trust factories, SSLv3, TLSv1)
2006/01/15 15:09:48:921 EST [DEBUG] HttpClient - SunJCE 1.5: SunJCE Provider
(implements RSA, DES, Triple DES, AES, Blowfish, ARCFOUR, RC2, PBE,
Diffie-Hellman, HMAC)
2006/01/15 15:09:48:921 EST [DEBUG] HttpClient - SunJGSS 1.0: Sun (Kerberos
v5)
2006/01/15 15:09:48:921 EST [DEBUG] HttpClient - SunSASL 1.5: Sun SASL
provider(implements client mechanisms for: DIGEST-MD5, GSSAPI, EXTERNAL, PLAIN,
CRAM-MD5; server mechanisms for: DIGEST-MD5, GSSAPI, CRAM-MD5)
2006/01/15 15:09:48:921 EST [DEBUG] DefaultHttpParams - Set parameter
http.useragent = Jakarta Commons-HttpClient/3.0
2006/01/15 15:09:48:937 EST [DEBUG] DefaultHttpParams - Set parameter
http.protocol.version = HTTP/1.1
2006/01/15 15:09:48:937 EST [DEBUG] DefaultHttpParams - Set parameter
http.connection-manager.class = class
org.apache.commons.httpclient.SimpleHttpConnectionManager
2006/01/15 15:09:48:937 EST [DEBUG] DefaultHttpParams - Set parameter
http.protocol.cookie-policy = rfc2109
2006/01/15 15:09:48:937 EST [DEBUG] DefaultHttpParams - Set parameter
http.protocol.element-charset = US-ASCII
2006/01/15 15:09:48:937 EST [DEBUG] DefaultHttpParams - Set parameter
http.protocol.content-charset = ISO-8859-1
2006/01/15 15:09:48:937 EST [DEBUG] DefaultHttpParams - Set parameter
http.method.retry-handler =
[EMAIL PROTECTED]
(mailto:[EMAIL PROTECTED])
2006/01/15 15:09:48:937 EST [DEBUG] DefaultHttpParams - Set parameter
http.dateparser.patterns = [EEE, dd MMM yyyy HH:mm:ss zzz, EEEE, dd-MMM-yy
HH:mm:ss zzz, EEE MMM d HH:mm:ss yyyy, EEE, dd-MMM-yyyy HH:mm:ss z, EEE, dd-MMM-yyyy
HH-mm-ss z, EEE, dd MMM yy HH:mm:ss z, EEE dd-MMM-yyyy HH:mm:ss z, EEE dd
MMM yyyy HH:mm:ss z, EEE dd-MMM-yyyy HH-mm-ss z, EEE dd-MMM-yy HH:mm:ss z, EEE
dd MMM yy HH:mm:ss z, EEE,dd-MMM-yy HH:mm:ss z, EEE,dd-MMM-yyyy HH:mm:ss z,
EEE, dd-MM-yyyy HH:mm:ss z]
2006/01/15 15:09:48:984 EST [DEBUG] DefaultHttpParams - Set parameter
http.protocol.cookie-policy = BROWSER_COMPATIBLE
2006/01/15 15:09:49:046 EST [DEBUG] HttpConnection - Open connection to
isc.nwservicecenter.com:443
2006/01/15 15:09:49:687 EST [DEBUG] header - >> "POST /iApp/isc/cmd/Login
HTTP/1.1[\r][\n]"
2006/01/15 15:09:49:687 EST [DEBUG] HttpMethodBase - Adding Host request
header
2006/01/15 15:09:49:703 EST [DEBUG] HttpMethodBase - Default charset used:
ISO-8859-1
2006/01/15 15:09:49:765 EST [DEBUG] HttpMethodBase - Default charset used:
ISO-8859-1
2006/01/15 15:09:49:765 EST [DEBUG] header - >> "User-Agent: Jakarta
Commons-HttpClient/3.0[\r][\n]"
2006/01/15 15:09:49:765 EST [DEBUG] header - >> "Host:
isc.nwservicecenter.com[\r][\n]"
2006/01/15 15:09:49:765 EST [DEBUG] header - >> "Content-Length: 37[\r][\n]"
2006/01/15 15:09:49:765 EST [DEBUG] header - >> "Content-Type:
application/x-www-form-urlencoded[\r][\n]"
2006/01/15 15:09:49:765 EST [DEBUG] header - >> "[\r][\n]"
2006/01/15 15:09:49:906 EST [DEBUG] EntityEnclosingMethod - Request body sent
2006/01/15 15:09:49:953 EST [DEBUG] header - << "HTTP/1.1 200 OK[\r][\n]"
2006/01/15 15:09:49:968 EST [DEBUG] header - << "Date: Sun, 15 Jan 2006
20:09:40 GMT[\r][\n]"
2006/01/15 15:09:49:968 EST [DEBUG] header - << "Server:
IBM_HTTP_Server/2.0.47 Apache/2.0.47 (Unix) DAV/2[\r][\n]"
2006/01/15 15:09:49:968 EST [DEBUG] header - << "Set-Cookie:
JSESSIONID=0001vfSuxGyOWuZ8mvrie73okQV:10hc91i5j;Path=/[\r][\n]"
2006/01/15 15:09:49:968 EST [DEBUG] header - << "Cache-Control:
private,no-cache="set-cookie,set-cookie2"[\r][\n]"
2006/01/15 15:09:49:968 EST [DEBUG] header - << "Expires: Thu, 01 Dec 1994
16:00:00 GMT[\r][\n]"
2006/01/15 15:09:49:968 EST [DEBUG] header - << "Transfer-Encoding:
chunked[\r][\n]"
2006/01/15 15:09:49:968 EST [DEBUG] header - << "Content-Type:
text/html;charset=ISO-8859-1[\r][\n]"
2006/01/15 15:09:49:968 EST [DEBUG] header - << "Content-Language:
en-US[\r][\n]"
2006/01/15 15:09:50:000 EST [DEBUG] HttpMethodBase - Cookie accepted:
"$Version=0; JSESSIONID=0001vfSuxGyOWuZ8mvrie73okQV:10hc91i5j; $Path=/"
2006/01/15 15:09:50:000 EST [DEBUG] HttpConnection - Input data available
2006/01/15 15:09:50:000 EST [WARN] HttpMethodBase - Going to buffer response
body of large or unknown size. Using getResponseBodyAsStream instead is
recommended.
2006/01/15 15:09:50:000 EST [DEBUG] HttpMethodBase - Buffering response body
2006/01/15 15:09:50:015 EST [DEBUG] HttpMethodBase - Resorting to protocol
version default close connection policy
2006/01/15 15:09:50:015 EST [DEBUG] HttpMethodBase - Should NOT close
connection, using HTTP/1.1
2006/01/15 15:09:50:015 EST [DEBUG] HttpConnection - Releasing connection
back to connection manager.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]