Hi,
I think the reason it doesn't work for you is because in order to make it
work you need to have a Sun implementation of HTTPUrlConnection on a
client, while here as I understand you use HttpClient of Apache that might
have no implementation of NTLM. When you connect to a proxy it internally
uses Sun implementation of HTTPUrlConnection so it works.
When you create a URL on your client you would better use it this way
handler = new sun.net.www.protocol.http.Handler();
urlToConnect = new URL (null, urlPath.toString(),handler);
URLConnection connection = urlToConnect.openConnection();
Try this and see if it works.
Evgeny
Martin Woodward
<martin.woodward@
gmail.com> To
[email protected]
06/27/2005 08:30 cc
PM
Subject
NTLM Authentication (again)
Please respond to
[EMAIL PROTECTED]
he.org
Hi,
I'm trying to talk to a web service that requires NTLM authentication
for my sins. The good news is that it works, the bad news is that I
have to proxy the request through a local instance of TCPmon to get it
to work. Does this sound familiar to anyone, I could very possibly be
me doing something dumb...
I am using axis-1_2_1, commons-httpclient-3.0-rc3, commons-codec-1.3
on j2sdk1.4.2_08 running in Windows XP Pro SP2.
As I say, everything works fine if I run up TCPMonitor on my machine
and then include the following lines in my client...
System.setProperty("http.proxyHost", "localhost");
System.setProperty("http.proxyPort", "8888");
I've allready edited my stub to add the username/password and added a
client-config.wsdd to point to the CommonsHTTPSender.
Below is the stack trace when I don't have the web service call proxied:-
AxisFault
faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
faultSubcode:
faultString: java.net.SocketException: Connection reset
faultActor:
faultNode:
faultDetail:
{http://xml.apache.org/axis/}stackTrace:java.net.SocketException:
Connection reset
at java.net.SocketInputStream.read(SocketInputStream.java:168)
at
java.io.BufferedInputStream.fill(BufferedInputStream.java:183)
at
java.io.BufferedInputStream.read(BufferedInputStream.java:201)
at
org.apache.commons.httpclient.HttpParser.readRawLine(HttpParser.java:77)
at
org.apache.commons.httpclient.HttpParser.readLine(HttpParser.java:105)
at
org.apache.commons.httpclient.HttpConnection.readLine(HttpConnection.java:1110)
at
org.apache.commons.httpclient.MultiThreadedHttpConnectionManager$HttpConnectionAdapter.readLine(MultiThreadedHttpConnectionManager.java:1391)
at
org.apache.commons.httpclient.HttpMethodBase.readStatusLine(HttpMethodBase.java:1832)
at
org.apache.commons.httpclient.HttpMethodBase.readResponse(HttpMethodBase.java:1592)
at
org.apache.commons.httpclient.HttpMethodBase.execute(HttpMethodBase.java:995)
at
org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:393)
at
org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:168)
at
org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:396)
at
org.apache.axis.transport.http.CommonsHTTPSender.invoke(CommonsHTTPSender.java:188)
at
org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)
at
org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
at
org.apache.axis.client.AxisClient.invoke(AxisClient.java:165)
at org.apache.axis.client.Call.invokeEngine(Call.java:2765)
at org.apache.axis.client.Call.invoke(Call.java:2748)
at org.apache.axis.client.Call.invoke(Call.java:2424)
at org.apache.axis.client.Call.invoke(Call.java:2347)
at org.apache.axis.client.Call.invoke(Call.java:1804)
at SNIP.whoAmI(SNIP.java:430)
at com.mrwpro.vsts.play.TestClient.main(TestClient.java:30)
{http://xml.apache.org/axis/}hostname:tst-028-04452
java.net.SocketException: Connection reset
at org.apache.axis.AxisFault.makeFault(AxisFault.java:101)
at
org.apache.axis.transport.http.CommonsHTTPSender.invoke(CommonsHTTPSender.java:277)
at
org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)
at
org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
at
org.apache.axis.client.AxisClient.invoke(AxisClient.java:165)
at org.apache.axis.client.Call.invokeEngine(Call.java:2765)
at org.apache.axis.client.Call.invoke(Call.java:2748)
at org.apache.axis.client.Call.invoke(Call.java:2424)
at org.apache.axis.client.Call.invoke(Call.java:2347)
at org.apache.axis.client.Call.invoke(Call.java:1804)
at SNIP.whoAmI(SNIP.java:430)
at com.mrwpro.vsts.play.TestClient.main(TestClient.java:30)
Caused by: java.net.SocketException: Connection reset
at java.net.SocketInputStream.read(SocketInputStream.java:168)
at
java.io.BufferedInputStream.fill(BufferedInputStream.java:183)
at
java.io.BufferedInputStream.read(BufferedInputStream.java:201)
at
org.apache.commons.httpclient.HttpParser.readRawLine(HttpParser.java:77)
at
org.apache.commons.httpclient.HttpParser.readLine(HttpParser.java:105)
at
org.apache.commons.httpclient.HttpConnection.readLine(HttpConnection.java:1110)
at
org.apache.commons.httpclient.MultiThreadedHttpConnectionManager$HttpConnectionAdapter.readLine(MultiThreadedHttpConnectionManager.java:1391)
at
org.apache.commons.httpclient.HttpMethodBase.readStatusLine(HttpMethodBase.java:1832)
at
org.apache.commons.httpclient.HttpMethodBase.readResponse(HttpMethodBase.java:1592)
at
org.apache.commons.httpclient.HttpMethodBase.execute(HttpMethodBase.java:995)
at
org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:393)
at
org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:168)
at
org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:396)
at
org.apache.axis.transport.http.CommonsHTTPSender.invoke(CommonsHTTPSender.java:188)
... 11 more
When I do have it proxied, you see the 401 error coming back from the
server, followed by a 100 with the final 200 response containing the
answer. When I run pointing to the proxy I also get the following
console output...
- Unable to find required classes (javax.activation.DataHandler and
javax.mail.internet.MimeMultipart). Attachment support is disabled.
- ntlm authentication scheme selected
- Discarding unexpected response: HTTP/1.1 100 Continue
Any ideas?
Thanks,
Martin.
--
http://www.woodwardweb.com