I am trying to connect to a third party SOAP 1.1 service that requires SSL security and user and password credentials. Example expected:
<soapenv:Header> <wsse:Security> <wsse:UsernameToken> <wsse:Username>username</wsse:Username> <wsse:Password>password</wsse:Password> </wsse:UsernameToken> </wsse:Security> </soapenv:Header>
My client configuration is as follows:
<system.serviceModel> <bindings> <basicHttpBinding> <binding name="thirdpartyservicebindingconfig"> <security mode="TransportWithMessageCredential"> <message clientCredentialType="UserName" algorithmSuite="Default" /> </security> </binding> </basicHttpBinding> </bindings> <client> <endpoint address="https://..." binding="basicHttpBinding" bindingConfiguration="thirdpartyservicebindingconfig" contract="thirdpartyservicecontract" name="thirdpartyserviceendpoint" /> </client> </system.serviceModel>
Client Service Code:
var client = new thirdpartyservicecontractclient(); client.ClientCredentials.UserName.UserName = "username"; client.ClientCredentials.UserName.Password = "password"; var result = client.DoSomething();
I get the following error message:
The security processor could not find the security header in the message. Perhaps this is due to the fact that the message is an unsecured error, or because there is a connecting mismatch between the parties. This can happen if the service is configured for security and the client is not using security.
EDIT:
If I reconfigure the security mode to "Transport":
<security mode="TransportWithMessageCredential">
I get an error from a third-party service:
com.sun.xml.wss.XWSSecurityException: message does not match configured policy [AuthenticationTokenPolicy (S)]: no security Header found; nested exception com.sun.xml.wss.XWSSecurityException: com.sun.xml.wss.XWSSecurityException: message does not match configured policy [AuthenticationTokenPolicy (S)]: no security Header found.
How to configure my client to connect to this service?
- WS Security Using Text Passwords over SSL
source share