WCF Soap Service Using Spring WS

0

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

soap
spring-ws
asked on Stack Overflow Feb 28, 2019 by Sonu Agarwal

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0