Can you please have a look at [1].
Thanks & regards.
-Prabath
[1]:
http://blog.RampartFAQ.com/2009/08/how-to-enable-ntlm-authentication-in.html
Martin Gilchrist wrote:
Hi, I wonder if anyone can help with this problem. We have a Web
Service impemented as a .Net application running on IIS 6.0. The
service is protected by NTLM authentication. I would like to test it
using an Axis2 (Release 1.5) client. I can run the WSDL2Java tool to
generate the client stub classes, and have written a client
application. However, each time, I run the application, I get a 401
error as follows:
[java] [INFO] Unable to sendViaPost to url[http://server/WBService] (
I have changed the URL)
[java] org.apache.axis2.AxisFault: Transport error: 401 Error:
Unauthorized
[java] at
org.apache.axis2.transport.http.HTTPSender.handleResponse(HTTPSender.java:295)
...
I have tried to follow the instructions regarding setting up NTLM
authentication in the client application, but as far as I can tell
from the IIS log, the authentication information is not getting passed
to the server. Here's my client code:
WBServiceStub wbServiceStub = new WBServiceStub();
Options options = wbServiceStub._getServiceClient().getOptions();
HttpTransportProperties.Authenticator authenticator = new
HttpTransportProperties.Authenticator();
List<String> auth = new ArrayList<String>();
auth.add(authenticator.NTLM);
authenticator.setAuthSchemes(auth);
authenticator.setUsername("username"); // Just username, no server
name or backslash
authenticator.setPassword("password");
authenticator.setHost("clientMachine"); // not sure if this correct
authenticator.setDomain("serverName"); // FQDN for server machine
authenticator.setPort(80); // Is this necessary?
authenticator.setRealm("serverName"); // FQDN for server machine?
authenticator.setPreemptiveAuthentication(true); // Is this necessary?
options.setProperty(org.apache.axis2.transport.http.HTTPConstants.AUTHENTICATE,
authenticator);
WBServiceStub.ServiceResponse serviceResponse = new
WBServiceStub.serviceMethods();
The machine is not part of a domain, so I am providing a local
username and password. Any help would be appreciated! Thanks, Martin