WCF charset=utf-8 of the response message does not match the content type of the binding (application/soap+xml; charset=utf-8)

As I suspected - your client-side config looks like this:

  <endpoint name="WSHttpBinding_ICommAccountingBinding" 
       address="https://secure.inmatecanteen.com/CommAccountingService/CommAccountingWeb.svc"
       binding="wsHttpBinding" 
       bindingConfiguration="WSHttpBinding_IInmateCanteenServiceWeb"
       contract="CommAccountingWeb.ICommAccountingWeb" />

It expects wsHttpBinding - but the server-side address it's connecting to is:

 <service name="CommAccountingWeb.CommAccountingWeb"  
          behaviorConfiguration="HttpMexBehavior">
     <endpoint 
         address="" 
         behaviorConfiguration="httpBehavior" 
         binding="webHttpBinding" bindingConfiguration="myWebHttpBinding" 
         contract="CommAccountingWeb.ICommAccountingWeb" />
     <host>
        <baseAddresses>
           <add baseAddress="https://secure.inmatecanteen.com/CommAccountingService/CommAccountingWeb.svc"></add>
        </baseAddresses>
     </host>
 </service>

and this server endpoint uses webHttpBinding.

So while the client expects a SOAP XML message (content type: application/soap+xml; charset=utf-8), the server-side endpoint is a REST endpoint which returns plain XML (content type: application/xml; charset=utf-8)

Solution: you need to make sure both the client and the server endpoint used are in sync with regards to bindings and configuration!


As Steven Westbrook says in a comment on this answer:

Add ?wsdl to your client's endpoint address, and you should have more luck with the service. ?wsdl is important - it means the browser is just getting "Web Services Description Language" for the service, and not calling the service.

I had the same issue and adding ?wsdl solved my headache.


I came across a similar error while creating a client service to one of the existing server side WebService. I could rectify it using SOAP 1.1 transport protocol on the client. Somehow soap 1.2 is giving/expecting a different format. This trace back to the difference between BasicHttpBinding vs WebHttpBinding vs WsHttpBinding.