Error 415 and WCF Compatibility between .Net 2.0 and 3.5

1 minute read Published:

If you try to call a 3.5 WCF Service with the framework 2.0 and WCF 3.0, you will have an error 415 :

Cannot process the message because the content type ‘text/xml; charset=utf-8’ was not the expected type ‘application/soap+xml; charset=utf-8’

‘text/xml’ is the content type for SOAP 1.1 while ‘application/soap+xml’ is the content type for SOAP 1.2 and your client WCF 3.0 use SOAP 1.1 while the service with WCF 3.5 use SOAP 1.2.

Here is the solution that worked for me. If you have access to the service config, you just have to change the binding to use SOAP 1.1 :

Add a new custom binding in the ‘bindings’ section

<customBinding>
        <binding name="Soap11HttpBinding">
          <textMessageEncoding messageVersion="Soap11" />
          <httpTransport />
        </binding>
      </customBinding>

and don’t forget to update your endpoint with the new binding :

<endpoint ...
        binding="customBinding"
        bindingConfiguration="Soap11HttpBinding">
        ...
    </endpoint>
comments powered by Disqus