Return-Path: Mailing-List: contact commons-httpclient-dev-help@jakarta.apache.org; run by ezmlm Delivered-To: mailing list commons-httpclient-dev@jakarta.apache.org Received: (qmail 93204 invoked from network); 26 Feb 2003 20:27:08 -0000 Received: from mxout5.cac.washington.edu (140.142.32.135) by daedalus.apache.org with SMTP; 26 Feb 2003 20:27:08 -0000 Received: from smtp.washington.edu (smtp.washington.edu [140.142.32.139]) by mxout5.cac.washington.edu (8.12.1+UW01.12/8.12.1+UW02.12) with ESMTP id h1QKRCFR003795 for ; Wed, 26 Feb 2003 12:27:12 -0800 Received: from u.washington.edu (ss02.co.us.ibm.com [32.97.110.67]) (authenticated bits=0) by smtp.washington.edu (8.12.1+UW01.12/8.12.1+UW02.12) with ESMTP id h1QKRBZH007853 (version=TLSv1/SSLv3 cipher=RC4-MD5 bits=128 verify=NOT) for ; Wed, 26 Feb 2003 12:27:12 -0800 Message-ID: <3E5D2326.8010509@u.washington.edu> Date: Wed, 26 Feb 2003 15:27:18 -0500 From: Michael Becke User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.3b) Gecko/20030210 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Commons HttpClient Project Subject: Re: HTTPClient query References: <01AE2307-4991-11D7-84DB-00306557E112@u.washington.edu> In-Reply-To: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N Hi Dheeraj, Are you hitting "https://websmp203.sap-ag.de/" through a proxy? If so, you you will need to setup the HttpClient instance for the proxy. You will also need to supply NTLM credentials if it is an NTLM proxy. Are you able to connect to other pages on this site besides the login page? Mike Dheeraj wrote: > Hi Mike: > > Thanks for your reply. I have posted the question to groups too. > I am trying to log the site https://websmp203.sap-ag.de/login which is authenticated by a proxy or NTLM. This would make it clear what I want. > I have tried both UsernamePasswordCredentials, and the NTCredentials. > I get a null at the line, and throws exception. However sometimes it returns 404 too, though the site is > there. > // execute the GET > int status = client.executeMethod( get ); > > My code does work for > HTTP, HTTPS (with out authentication) , and authentication for Tomcat. > > I hope I am sufficiently clear. Would you please solve the mystery, > > Thank You > > Dheeraj > > > Following are the details with respect to the problem. > > package com.kcit.jakarta; > > import org.apache.commons.httpclient.HttpClient; > import org.apache.commons.httpclient.UsernamePasswordCredentials; > import org.apache.commons.httpclient.SimpleHttpConnectionManager; > import org.apache.commons.httpclient.HostConfiguration; > import org.apache.commons.httpclient.NTCredentials; > import org.apache.commons.httpclient.methods.GetMethod; > import org.apache.commons.httpclient.methods.PostMethod; > > public class BasicAuthenticatonExample { > > public BasicAuthenticatonExample() { > } > > public static void main(String[] args) throws Exception { > HttpClient client = new HttpClient(); > client.setConnectionTimeout(100000000); > > client.getState().setCredentials( > "SAP Service Marketplace", > new UsernamePasswordCredentials(, ) > ); > > > > GetMethod get = new GetMethod("https://websmp203.sap-ag.de/login"); > > > get.setDoAuthentication(true); > > // execute the GET > int status = client.executeMethod( get ); > > // print the status and response > System.out.println(status + "\n" +get.getResponseBodyAsString()); > > // release any connection resources used by the method > get.releaseConnection(); > } > } > > > ----- Original Message ----- > From: Michael Becke > To: Dj > Sent: Wednesday, February 26, 2003 7:18 PM > Subject: Re: HTTPClient query > > > Hello Dheeraj, > > If you could, please provide more information about what you are trying > and what is failing. A test case that shows the problem is always > good. Also, please post the question to the HttpClient mailing list at > commons-httpclient-dev@jakarta.apache.org (you will have to subscribe > first). This will ensure that others can benefit from any possible > solution. > > A http 404 response means that the file was not found. Are you sure > that you are posting to a URL that exists? > > Mike > > On Wednesday, February 26, 2003, at 12:33 AM, Dj wrote: > > > Hi Michael: > > > > Please refer it to /commons/HTTPClient and a sample program written by > > you BasicAuthenticatonExample.java. > > I am able to run this program for > > 1. simple HTTP > > 2. HTTPS > > 3. HTTP with Basic authenticator - tested on Tomcat's Manager. > > > > I am stuck as I wish to hook on to a site which has a Basic > > authentication with HTTPS. All the while I get a 404 Screen. > > Would you please help me with it. You code is very easy to implement > > except for this case. > > > > I need to make this tool very urgently. A quick technical help by is > > highly appreciated. > > > > Thank You, > > > > > > Dheeraj Srivastava > > >