|
|
submitted by
PauloMorgado
1 year, 7 months ago
msmvps.com — I'm a newbie in WFC and, so far, only have done client code to call POX web services.
I've been using a textMessageEncoding binding extension with a message version of None and a write encoding of utf-8 and all has been running fine.
Well, until I needed to call a service in iso-8859-1 encoding. Then I started getting a ProtocolException:
Message="The content type text/xml;charset=iso-8859-1 of the response message does not match the content type of the binding (text/xml; charset=utf-8). If using a custom encoder, be sure that the IsContentTypeSupported method is implemented properly.
Bruno directed me to a sample that looked promising. The sample works fine because it's using the same binding extension in the server and in the client.
When I tried to use the customTextMessageBinding from the sample, I got this nice ProtocolException:
The content type text/xml;charset=iso-8859-1 of the response message does not match the content type of the binding (text/xml; charset=iso-8859-1). If using a custom encoder, be sure that the IsContentTypeSupported method is implemented properly.
Looks kind of funny, doesn't it?
It comes down to the fact that the base MessageEncoder class doing a string comparison on the content type.
To solve this, I overrided the IsContentTypeSupported method and added an additional validadion when the validation fails. This new validation only checks for the media type of the response and lets the XmlReader handle the encoding.
|
|
tags:
WebServices, WCF | tag it
Everyones tags: | Your tags: | |
|
|
|
Add a live kick counter to your blog >>
You can even customize the image by choosing your own colors, and then clicking
the button below to update the preview and the html code:
Simply copy and paste this HTML into your blog post.
Users who kicked this story:
No comments so far
|