Problem when sending an xml string to a web service

  • Thread starter Thread starter anonymous
  • Start date Start date
A

anonymous

Hi,

I'am sending an xml string to a web service(which is written in c#)
using the microsoft web services behavior.
When I check this string from the web service I observed that some of
the charaters have been replaced.

e.g "<" is replaced with "%3C", ">" is replaced with "%3E"


characters lik =," are replaced too.

can anybody explain the reason for this and give a solution

Thanks
 
The problem you are seeing is by design. A webservice communications via XML
over HTTP. Therefore, if the data you are sending is also XML, and no
changes were made to the data, the webservice would not be-able to
destinguish the Webservice XML from the dataXML and the it would not work.
Therefore, everything you send to the webservice must first be encoded. You
can use the built in System.Web.HttpUtility.UrlEncode function to encode
your data before sending.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top