使用Spring WS的WCF Soap服务

时间:2019-02-28 14:52:14

标签: soap spring-ws

我正在尝试使用spring-ws消耗wcf soap服务 但是尝试访问该服务时遇到以下错误。尽管凭据正确。

org.springframework.ws.soap.client.SoapFaultClientException: Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))

当我尝试从.NET应用程序使用时,相同的服务正在工作。

我可以发现以下两种方式的身份验证机制有所不同

Java身份验证:

Authorization: NTLM {GeneratedAuthorizationToken}

.NET身份验证

Authorization: Negotiate {GeneratedAuthorizationToken}

我已经如下配置了WebServiceTemplate

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());

任何建议/想法摆脱此错误

0 个答案:

没有答案