Search code examples
c#wcfwcf-binding

BasicHttpBinding and MessageVersion.None


How to configure XML web services client to use MessageVersion.Soap11WSAddressing10 for header namespaces. Currently it uses MessageVersion.None namespace, without me able to change it.


Solution

  • You need to do this using a custom WCF binding:

      <system.serviceModel>
        <bindings>
          <customBinding>
            <binding name="Soap11Addr10">
              <textMessageEncoding messageVersion="Soap11WSAddressing10" />
              <httpTransport/>
            </binding>
          </customBinding>
        </bindings>
    

    and then reference that custom binding (by name) in your service endpoint:

        <services>
          <service name="YourAssembly.YourService">
            <endpoint name="test"
                      address=""
                      binding="customBinding"
                      bindingConfiguration="Soap11Addr10"
                      contract="YourAssembly.IYourService" />
          </service>
        </services>
      </system.serviceModel>
    

    If you want to use this from a client, you also need to copy the custom binding configuration to the client's app.config or web.config and reference it there, of course (using Add Service Reference in Visual Studio will do this for you).