[ 
https://issues.apache.org/jira/browse/AXIS2-1929?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12461914
 ] 

Saminda Wishwajith Abeyruwan commented on AXIS2-1929:
-----------------------------------------------------

The problem is in AbstractHttpSender line 373. 

Correct code should be 

            if (host != null) {
                    if (domain != null) {
                        /*Credentials for NTLM Authentication*/
                        creds = new NTCredentials(username, password, host, 
domain);
                    } else {
                        /*Credentials for Digest and Basic Authentication*/
                        creds = new UsernamePasswordCredentials(username, 
password);
                    }
                    agent.getState().setCredentials(new AuthScope(host, port, 
realm), creds);
                } else {
                    if (domain != null) {
                        /*Credentials for NTLM Authentication when host is 
ANY_HOST*/
                        creds = new NTCredentials(username, password, 
AuthScope.ANY_HOST, domain);
                        agent.getState().setCredentials(
                                new AuthScope(AuthScope.ANY_HOST, port, realm), 
creds);
                    } else {
                        /*Credentials only for Digest and Basic Authentication*/
                        creds = new UsernamePasswordCredentials(username, 
password);
                        agent.getState().setCredentials(new 
AuthScope(AuthScope.ANY), creds);
                    }
                }

> NTLM Credentials settings
> -------------------------
>
>                 Key: AXIS2-1929
>                 URL: https://issues.apache.org/jira/browse/AXIS2-1929
>             Project: Apache Axis 2.0 (Axis2)
>          Issue Type: Bug
>          Components: transports
>    Affects Versions: nightly
>         Environment: Any 
>            Reporter: Saminda Wishwajith Abeyruwan
>         Assigned To: Saminda Wishwajith Abeyruwan
>
> This has been reported by Jonathan McCracken ([EMAIL PROTECTED])
> ===========================================
> Hello Samindaa,
> First off thank you for contributing to Axis2, and I hope you have the
> time to respond to my question regarding getting NTLM working for my
> Client Stub in 1.1 release.
> I've looked through all the articles I can find and have turned up
> with the same error. I'm using the following code to modify my stub:
> public AdminWebServiceStub() throws org.apache.axis2.AxisFault {
>         populateAxisService();
>         populateFaults();
>         ConfigurationContext configurationContext = null;
>         _serviceClient = new
> org.apache.axis2.client.ServiceClient(configurationContext,_service);
>         configurationContext =
> _serviceClient.getServiceContext().getConfigurationContext();
>         //setup NTLM auth
>         HttpTransportProperties.Authenticator
>                               auth = new
> HttpTransportProperties.Authenticator();
>         auth.setDomain("domain");
>        auth.setUsername("username");
>        auth.setPassword("password");
> //do not set HOST or PORT...although I've tried this and both return
> same error       //auth.setHost("url");
>        //auth.setPort(83));
>        //NTLMScheme ntlmAuthScheme = new NTLMScheme();
>        //ArrayList authSchemes = new ArrayList();
>        //authSchemes.add(ntlmAuthScheme);
>        //auth.setAuthSchemes(authSchemes);
>         //set NTLM auth
>         
> _serviceClient.getOptions().setProperty(org.apache.axis2.transport.http.HTTPConstants.AUTHENTICATE,
> auth);
>         //set webservice end-point
>         _serviceClient.getOptions().setTo(new
> org.apache.axis2.addressing.EndpointReference("url"));
>         //Set the soap version
>         
> _serviceClient.getOptions().setSoapVersionURI(org.apache.axiom.soap.SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI
>  );
> }
> /////////////END CODE
> The error I get is as follows:
> Jan 2, 2007 3:07:15 PM
> org.apache.commons.httpclient.HttpMethodDirector
> processWWWAuthChallenge
> WARNING: Unable to respond to any of these challenges: {negotiate=Negotiate}
> org.apache.axis2.AxisFault: HTTP Transport error : '401' -
> 'Unauthorized'; nested exception is:
>         org.apache.axis2.AxisFault: HTTP Transport error : '401' -
> 'Unauthorized'; nested exception is:
>         org.apache.axis2.AxisFault: HTTP Transport error : '401' -
> 'Unauthorized'; nested exception is:
>         org.apache.axis2.AxisFault: HTTP Transport error : '401' - 
> 'Unauthorized'
>         at 
> org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(CommonsHTTPTransportSender.java:225)
>         at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:670)
>         at org.apache.axis2.description.OutInAxisOperationClient.send 
> (OutInAxisOperation.java:365)
>         at 
> org.apache.axis2.description.OutInAxisOperationClient.execute(OutInAxisOperation.java:295)
>         at 
> com.transcanada.safex.externalAccess.tedsProxy.AdminWebServiceStub.GetUser 
> (AdminWebServiceStub.java:622)
>         at 
> com.transcanada.safex.junit.TestTedsBindingStub.testGetUser(TestTedsBindingStub.java:31)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>         at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>         at com.intellij.rt.execution.junit2.JUnitStarter.main 
> (JUnitStarter.java:31)
> Caused by: org.apache.axis2.AxisFault: HTTP Transport error : '401' -
> 'Unauthorized'; nested exception is:
>         org.apache.axis2.AxisFault: HTTP Transport error : '401' - 
> 'Unauthorized'
>         at 
> org.apache.axis2.transport.http.CommonsHTTPTransportSender.writeMessageWithCommons(CommonsHTTPTransportSender.java:340)
>         at 
> org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(CommonsHTTPTransportSender.java
>  :205)
>         ... 23 more
> Caused by: org.apache.axis2.AxisFault: HTTP Transport error : '401' -
> 'Unauthorized'
>         at 
> org.apache.axis2.transport.http.SOAPOverHTTPSender.send(SOAPOverHTTPSender.java
>  :144)
>         at 
> org.apache.axis2.transport.http.CommonsHTTPTransportSender.writeMessageWithCommons(CommonsHTTPTransportSender.java:334)
>         ... 24 more
> /////////END STACK TRACE
> I'm not sure what I'm doing wrong, as far as I can tell my client has
> the correct HTTPTransportProperties at runtime (i've debugged this one
> a few times). I've also checked the credentials and they work, but the
> error seems to be related to not being able to respond to the NTLM
> Negotiate challenge?
> Any help/ideas would be greatly appreciated.
> Thanks,
> Jonathan
> ===========================================
> The problem is in AbstractHttpSender

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
https://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to