I am trying to consume a wcf soap service using spring-ws But i am facing with the below error while trying to access the service.Although the credentials are correct.
org.springframework.ws.soap.client.SoapFaultClientException: Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))
While the same service is working when i try to consume from a .NET application.
I could find a difference in authentication mechanism between the two ways as below
Java Authentication:
Authorization: NTLM {GeneratedAuthorizationToken}
.NET Authentication
Authorization: Negotiate {GeneratedAuthorizationToken}
I have configured my WebServiceTemplate as below
public HttpComponentsMessageSender httpComponentsMessageSender() {
HttpComponentsMessageSender httpComponentsMessageSender = new HttpComponentsMessageSender();
CredentialsProvider credsProvider = new BasicCredentialsProvider();
credsProvider.setCredentials(AuthScope.ANY,
new NTCredentials("MyUserName", "MyPassword", null, "MyDomain"));
httpComponentsMessageSender.setCredentials(credsProvider.getCredentials(AuthScope.ANY));
return httpComponentsMessageSender;
}
WebServiceTemplate webServiceTemplate = new WebServiceTemplate(marshaller, marshaller);
webServiceTemplate.setMessageSender(httpComponentsMessageSender());
Any suggestion/idea to get rid of this error
User contributions licensed under CC BY-SA 3.0