I believe that your problem is the fact that by calling the "GetMethod(url)" constructor, you are creating a method with its own host configuration; in this case, the method's host configuration is used when the method is executed (as opposed to the default host configuration that you have created on the connection).
In other words, the host, port, and path information for the specific method invocation are extracted from the URL that you used to construct the GetMethod. If you replace this code: client.getHostConfiguration()... with this code: method.getHostConfiguration()... You should be all set. Either that or call the parameter-less GetMethod constructor, which will cause it to default to the host configuration for your client. OR you could call: client.executeMethod( client.getHostConfiguration(), method, client.getState()) That should work, too. Hope that helps, Bob -----Original Message----- From: Yuzwa, Erik [mailto:[EMAIL PROTECTED] Sent: Friday, October 08, 2004 10:53 AM To: 'Commons HttpClient Project' Subject: RE: getting through a proxy server Madeleine, Stupid question but is your proxy server using NTLM authentication? I had to do some hoop jumping to get NTLM to work properly, but it's working now if you need some code. Erik -----Original Message----- From: Madeleine Wright [mailto:[EMAIL PROTECTED] Sent: Friday, October 08, 2004 8:46 AM To: Commons HttpClient Project Subject: getting through a proxy server Please can someone suggest the simplest way to access a URL programatically through a proxy server? I'm using HttpClient and the proxy bits of my code look like this (everything else works fine - I can access all sites inside the firewall): HttpClient client = new HttpClient(); ................. client.getHostConfiguration().setProxy(proxyHost, proxyPort); Credentials creds = new UsernamePasswordCredentials(userName, password); client.getState().setProxyCredentials(realm, proxyHost, defaultcreds); ....................... GetMethod method = new GetMethod(url); I realize I seem to be supplying proxy host details twice! But I can't otherwise see how to set the proxy port? I keep getting an "access denied" message from the proxy server, indicating that I have not authenticated myself. Does anyone know how I do that other than the method above (I am sure the actual proxy details given are correct). Thanks. Mad --------------------------------------------------------------------- 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]