I am trying to write a client to call a web service that uses WS-Security 1.1 . They provided a WSDL and I generated the code through Visual Studio.
(UPDATE) Here is the binding
<basicHttpBinding>
<binding name="BasicHttpBinding_IConnectService">
<security mode="TransportWithMessageCredential" />
</binding>
</basicHttpBinding>
Here is my request
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Header>
...
<Security s:mustUnderstand="1" xmlns="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:o="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:u="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
<u:Timestamp u:Id="7c10648f-984d-4920-849e-b0afb586f871">
<u:Created>2016-08-24T13:08:06.118Z</u:Created>
<u:Expires>2016-08-24T14:08:06.118Z</u:Expires>
</u:Timestamp>
<o:UsernameToken>
<o:Username>actualUsername</o:Username>
<o:Password>realPassword</o:Password>
</o:UsernameToken>
</Security>
</s:Header>
<s:Body xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
Through Fiddler, I can see that the data I want is getting returned.
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" xmlns:u="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
<s:Header>
<o:Security s:mustUnderstand="1" xmlns:o="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
<u:Timestamp u:Id="_0">
<u:Created>2014-05-02T14:02:46.988Z</u:Created>
<u:Expires>2014-05-02T14:07:46.988Z</u:Expires>
</u:Timestamp>
</o:Security>
</s:Header>
<s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
....
The data I really want
However, in Visual Studio I get this error:
The header 'Security' from the namespace 'http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd' was not understood by the recipient of this message, causing the message to not be processed. This error typically indicates that the sender of this message has enabled a communication protocol that the receiver cannot process. Please ensure that the configuration of the client's binding is consistent with the service's binding.
How do I correct this error? Given that I see the data coming back, it seems like a configuration problem.