We have some issues with a WCF SOAP service that we publish, and is consumed by one of our customers. The issue is that the customer makes SOAP requests encoded as ISO-8859-1, which results in the error message:
HTTP/1.1 415 Cannot process the message because the content type 'text/xml;charset=iso-8859-1' was not the expected type 'text/xml; charset=utf-8'.
Apparently, WCF only supports UTF-8 and UTF-16 big endian, according to http://msdn.microsoft.com/en-us/library/ms751486(v=VS.90).aspx. The problem is also discussed in these questions on SO:
- Calling a webservice that uses ISO-8859-1 encoding from WCF
- WCF Exception: Text Message Encoding and ISO-8859-1 Encoding
While I agree that unicode is preferred, I'm not in a position to force our customer to change their client, so I will have to fix our service.
It bugs me that I need to put >150 lines of code written by some MSDN author into my project - I can't maintain that code or take responsibility for it. I've also spent quite some time to Google for solutions and try to understand them, which I feel is a waste of time for something that could be handled out of the box by WCF.
My question is: is there any good reason for Microsoft to implement WCF this way? Is there a technical reason why SOAP shouldn't use ISO-8859-1? To me, this seems to break Postel's law, rejecting messages that can really be handled by almost any XML parser out there.