Restful WCF Service - how to send data with illegal XML characters?
Posted
by Chris
on Stack Overflow
See other posts from Stack Overflow
or by Chris
Published on 2010-03-14T18:40:17Z
Indexed on
2010/03/14
18:45 UTC
Read the original article
Hit count: 355
I have a RESTful WCF web service.
One of my methods has several input parameters.
One of the input parameters is a string. Some times the data I am passing to this web method will include content that has one or more "illegal characters" - i.e. "&". So, I replace this with &
before passing it to the web service - but it still throws an exception. The exception isn't visible, as the data never reaches the web service, but I know that it is this content that is causing the problem, as I have done several tests sending data that doesn't contain an illegal XML character, and every time it worked, but any data containing "&" will fail. Am I not supposed to replace "&" with &
?
Please refer to the web method below:
[WebGet]
public MapNode AddMapNode(string nodeText)
{
return new inProcessEntities().AddMapNode(nodeText);
}
Please help on how I can fix this.
Thanks.
Chris
© Stack Overflow or respective owner