Please use the following code

HttpTransportProperties.Authenticator ntlmAuthentication =
                    new HttpTransportProperties.Authenticator();

            ntlmAuthentication.setUsername("axis2");
            ntlmAuthentication.setPassword("axis2");
            ntlmAuthentication.setHost("axis2");
            ntlmAuthentication.setPort(9443);
            ntlmAuthentication.setRealm("someRealm");
ntlmAuthentication.setAllowedRetry(boolean allowedRetry)

            options.setProperty(
org.apache.axis2.transport.http.HTTPConstants.AUTHENTICATE,
                    ntlmAuthentication);

On Wed, Jun 11, 2008 at 7:29 PM, Lozina, Tony {PBSG} <[EMAIL PROTECTED]>
wrote:

> I am trying to connect to a web service using Axis2 version 1.4 (Latest
> one available for download from the site) and Java version 1.4.2
>
> I can reach the web service but I keep failing to authenticate, as I do
> not really know how to properly authenticate using NTLM.
>
> I am getting the following error attempting to connect:
>
> Transport error: 401 Error: Unauthorized
> org.apache.axis2.AxisFault: Transport error: 401 Error: Unauthorized
>
> There was some code online describing how you can create an instance of
> HttpTransportProperties.NTLMAuthentication however that subclass
> "NTLMAuthentication" does not exist anywhere in the Apache Axis2 JAR and
> my compiler gets an error on that line. I have no idea what version they
> were using but it is certainly not the latest one.
>
> Here's the code I have now to reach the web service:
>
> TestStub stub = new TestStub();
> Options options = stub._getServiceClient().getOptions();
>
> HttpTransportProperties.ProxyProperties proxy = new
> HttpTransportProperties.ProxyProperties();
> proxy.setProxyPort(80);
> proxy.setDomain("someproxy.somedomain.com");
> proxy.setProxyName("someproxy.somedomain.com");
> options.setProperty(org.apache.axis2.transport.http.HTTPConstants.PROXY,
> proxy);
>
> TestStub.GetTestResponse resp = stub.GetTest(new TestStub.GetTest());
>
> What do I need to change here to properly use NTLM authentication?
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


-- 
Saminda Abeyruwan

Senior Software Engineer
WSO2 Inc. - www.wso2.org

Reply via email to