Search code examples
c#wcfsoapwcf-bindingbasichttpbinding

Allow BasicHttpBinding to process custom content types


I have a client that does send Soap11 content, but with a different content type. It does not send text/xml but application/some-custom-header.

The client receives the following exception Cannot process the message because the content type 'application/some-custom-header; charset=utf-8' was not the expected type 'text/xml; charset=utf-8'.

what do i need to change?


Solution

  • I got it. I combined the encoding elements from the Invoking a web service returning ISO-8859-1 encoded data with BizTalk 2010 example, but replaced the Read/WriteMessage methods from the CustomMessageEncoder with the calls to a MessageEncoder retrieved from a TextMessageEncodingBindingElement and its MessageEncoderFactory.