Add WS Addressing SOAP header

Dec 13, 2010 at 9:23 AM


I am using a WCF client to connect to a web service hosted on IBM WebSphere/DataPower.

I need the SOAP message to be sent in the following format:

<soapenv:Envelope xmlns:soapenv="
 xmlns:ns="<custom namespace>"  xmlns:ver="<custom namespace>
      <wsse:Security soapenv:mustUnderstand="1" xmlns:wsse="">
      <a:Action><!--Action URL--></a:Action>
      <a:To><!-- To URL--></a:To>

The elements in bold need to be inserted in the SOAP header. I am using the WSDL provided by the service owner to create the service reference from Visual Studio 2010.

Is it possible to do this using WCF Extras? Any other good alternative?


Jan 11, 2011 at 7:46 PM

I am seeking to do the exact same thing, did you have any success implementing this? thanks

Jan 12, 2011 at 2:33 PM


Yes I could solve it by using the following customBinding



        <binding name="SecuritySoapWSAddressing">
          <textMessageEncoding messageVersion="Soap11WSAddressing10" writeEncoding="utf-8" />
          <security authenticationMode="UserNameOverTransport" includeTimestamp="false" />
          <httpsTransport maxBufferPoolSize="52428800" maxReceivedMessageSize="6553600" maxBufferSize="6553600" 
                          requireClientCertificate="true" />

and used it in the endpoint as below:
      <endpoint address="<URL>"
        binding="customBinding" bindingConfiguration="SecuritySoapWSAddressing"
        contract="SecureMociRegnSvcRef.MOCIRegistrationService" name="MOCIRegistrationServicePort" />

Jan 12, 2011 at 3:50 PM

thanks a lot for your reply niyazshah,

in addition to the binding/endpoint config, can you post the code you used to pass the authentication token?


Jan 12, 2011 at 5:58 PM

Please see the code below:

            client.ChannelFactory.Credentials.UserName.UserName = wsseUser;
            client.ChannelFactory.Credentials.UserName.Password = wssePwd;

where client is the proxy client for the service