I am trying to connect to a third party SOAP 1.1 service that requires SSL security and username/password credentials. An example of what is expected is:
<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>
Service client code is:
var client = new thirdpartyservicecontractclient();
client.ClientCredentials.UserName.UserName = "username";
client.ClientCredentials.UserName.Password = "password";
var result = client.DoSomething();
I'm getting the following fault exception message:
Security processor was unable to find a security header in the message. This might be because the message is an unsecured fault or because there is a binding mismatch between the communicating parties. This can occur if the service is configured for security and the client is not using security..
EDIT:
If I reconfigure security mode to "Transport":
<security mode="TransportWithMessageCredential">
I get an error from the third party service:
com.sun.xml.wss.XWSSecurityException: Message does not conform to configured policy [ AuthenticationTokenPolicy(S) ]: No Security Header found; nested exception is com.sun.xml.wss.XWSSecurityException: com.sun.xml.wss.XWSSecurityException: Message does not conform to configured policy [ AuthenticationTokenPolicy(S) ]: No Security Header found.
How can I configure my client to connect to this service?
- WS Security using plain text passwords over SSL