You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by "Lozina, Tony {PBSG}" <to...@pbsg.com> on 2008/06/11 15:59:42 UTC
Need NTLM Authentication help
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: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org
Re: Need NTLM Authentication help
Posted by Saminda Abeyruwan <sa...@gmail.com>.
HttpTransportProperties.Authenticator ntlmAuthentication =
> new HttpTransportProperties.Authenticator();
>
> ntlmAuthentication.setUsername("axis2");
> ntlmAuthentication.setPassword("axis2");
> ntlmAuthentication.setHost("axis2");
> ntlmAuthentication.setPort(9443);
> ntlmAuthentication.setRealm("someRealm");
> ntlmAuthentication.setAllowedRetry(true)
>
> options.setProperty(
> org.apache.axis2.transport.http.HTTPConstants.AUTHENTICATE,
> ntlmAuthentication);
On Thu, Jun 12, 2008 at 12:17 PM, Saminda Abeyruwan <sa...@gmail.com>
wrote:
> 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} <
> tony.lozina1@pbsg.com> 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: axis-dev-unsubscribe@ws.apache.org
>> For additional commands, e-mail: axis-dev-help@ws.apache.org
>>
>>
>
>
> --
> Saminda Abeyruwan
>
> Senior Software Engineer
> WSO2 Inc. - www.wso2.org
--
Saminda Abeyruwan
Senior Software Engineer
WSO2 Inc. - www.wso2.org
Re: Need NTLM Authentication help
Posted by Saminda Abeyruwan <sa...@gmail.com>.
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} <to...@pbsg.com>
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: axis-dev-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-dev-help@ws.apache.org
>
>
--
Saminda Abeyruwan
Senior Software Engineer
WSO2 Inc. - www.wso2.org