0

I Have to write a WCF Interceptor which will extend the WCF Behaviour

The behavior of my extension is that it will add a custom header to the request....

custom Header is going to be like below

  <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">
<wsse:UsernameToken wsu:Id="UsernameToken-8"
  xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
  <wsse:Username>TeStUsErNaMe1</wsse:Username>
  <wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText"                  >TeStPaSsWoRd1</wsse:Password>
  <wsse:Nonce EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary"                  >f8nUe3YupTU5ISdCy3X9Gg==</wsse:Nonce>
  <wsu:Created>2011-05-04T19:01:40.981Z</wsu:Created>
</wsse:UsernameToken>
</wsse:Security>

I have written a CustomCredential which will add the header to the request.

my problem is how to wirte extension of this WCF Behavior

as it is using CustomCredentials

I want something like below

client.ChannelFactory.Endpoint.Behaviors.Remove(); client.ChannelFactory.Endpoint.Behaviors.Add(new CustomCredentials());

in my WCF Interceptor

user1104946
  • 680
  • 1
  • 9
  • 30

1 Answers1

0

Here is a good article on how to do this. It explains it in detail and worked great on a WS-Security webservice that required a Nonce and Created.

http://www.west-wind.com/weblog/posts/2012/Nov/24/WCF-WSSecurity-and-WSE-Nonce-Authentication

h8a
  • 126
  • 1
  • 10