Hi Shahbaz, The HttpClient codebase has changed a fair bit since the version I know and am using so I don't have a full source code example to look at, but hopefully the information below will help a bit. If you still don't get it working, could you send through the code your currently using and we'll pick it to bits. :)
1. NTLM authentication works almost exactly the same as any other form of authentication in terms of the HttpClient API. The only difference is that you need to supply 'NTCredentials' instead of 'UsernamePasswordCredentials' (NTCredentials actually extends UsernamePasswordCredentials so you can use NTCredentials right throughout your application if need be). 2. Proxy authentication information is added and stored separately to regular authentication information, so you need to call setProxyCredentials(String realm, Credentials credentials) instead of setCredentials(...). Both of these methods are in HttpState. 3. The realm for NTLM authentication is the domain name of the computer being connected to, this can be troublesome as servers often have multiple names but since NTLM doesn't understand the concept of realms that's what we're stuck with. I'd suggest that at least during testing you pass the realm in as null which is used as the default. 4. Now, as for persistant connections, HttpClient should do that for you automatically, but you need to be sure to call releaseConnection() on the HttpMethod when you're finished with it. 5. NTLM authenticates a connection and not a request, so you need to authenticate every time a new connection is made and keeping the connection open during authentication is vital. 6. Because of (5) you cannot use NTLM to authenticate with both a proxy and the webserver. It looks like there may be some strange things going on between you and the proxy so it would probably be helpful to take a look at the wire trace log - see http://jakarta.apache.org/commons/httpclient/logging.html for more information about the logging capabilities of HttpClient. Finally, the version of HttpClient your using (or the approximate time it was checked out of CVS) is very important as there have been a lot of changes and improvements to HttpClient in the last few months and some of those fixes may help you out. Hope that gives you some help anyway, we can do more with more information. :) Adrian Sutton, Software Engineer Ephox Corporation www.ephox.com -----Original Message----- From: Shahbaz Khalid [mailto:[EMAIL PROTECTED]] Sent: Tuesday, 18 February 2003 6:28 AM To: [EMAIL PROTECTED] Subject: NTLM Proxy Authentication Hello, Sorry about the previous empty message - need more coffee :) Anyways, I am trying to authenticate with an NTLM Proxy server, and have been successful in doing so. But, not without a catch. Firstly, I am getting an exception (Connection closed by peer) in between the authentication process, AND, even if I try to reuse the GetMethod, I end up getting authenticated each time. Can someone show me the correct way to go about solving this problem ? Basically, I need : 1. Code examples, 2. COrrect way to authenticate with NTLM Proxies 3. Persistent connections Any help would be greatly appreciated. cheers __________________________________________________ Do You Yahoo!? Everything you'll ever need on one web page from News and Sport to Email and Music Charts http://uk.my.yahoo.com --------------------------------------------------------------------- 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]