I am trying to create a custom binding to output this type of XML header:
<soapenv:Header> <wsse:Security soapenv:mustUnderstand="1" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"> <wsse:UsernameToken wsu:Id="UsernameToken-BEC9D84D8B68A3118D14543420311491"> <wsse:Username>user</wsse:Username> <wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">pass</wsse:Password> <wsse:Nonce EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary">hBcjVXk/NxiSiva5xXKphA==</wsse:Nonce> <wsu:Created>2016-02-01T15:53:51.146Z</wsu:Created> </wsse:UsernameToken> </wsse:Security>
Here is my code:
var customBinding= new CustomBinding(); var securityBindingElement = SecurityBindingElement.CreateUserNameOverTransportBindingElement(); securityBindingElement.IncludeTimestamp = false; customBinding.Elements.Add(securityBindingElement); customBinding.Elements.Add(new TextMessageEncodingBindingElement()); var transportElement = new HttpsTransportBindingElement(); customBinding.Elements.Add(transportElement);
However, I continue to receive a message with the message:
The message could not be processed. This is most likely because the action is incorrect or because the message contains an invalid or expired security context token or because there is a mismatch between bindings The message could not be processed. This is most likely because the action is incorrect or because the message contains an invalid or expired security context token or because there is a mismatch between bindings .
I am quite sure that this is due to my setup, but I have a terribly difficult time trying to figure out what properties need to be configured for what. Appreciate any guidance !!!
99823 source share