Custom Message Encoder for WCF Rest web service
$100-250 USD
Πληρώθηκε κατά την παράδοση
We receive XML posts to our WCF REST web service (ASP.NET, C#) and sometimes the text for some of the elements may contain an ampersand. We suggested to the company that is submitting the posts that they enclose the text in CDATA sections to avoid the parsing error that results when there is an ampersand in the text, but they have reasons for not changing their application.
It appears that the only option is to define a custom binding, based on a custom message encoder, which fixes the incoming stream before passing it through the XmlDictionaryReader bus. Optimally the fix would be to change the literal ampersand to &.
Another developer has developed a custom message encoder for our REST service, but is not sure how to get it to work. I can provide this code.
I came across this article that may be helpful. It explains the steps needed to implement a custom message encoder to change the content of the XML post, but not sure if it is applicable to dealing with invalid XML - a literal ampersand:
[url removed, login to view]
Ταυτότητα Εργασίας: #3772367