By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,356 Members | 1,023 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,356 IT Pros & Developers. It's quick & easy.

Web Services returns string: which is XML and the angle brackets are encoded?

P: n/a
We have a web service that returns a string which happens to be well formed
XML. The client sees the string ok, except the angle brackets are HTML
encoded ( &gt and &lt ).

Is this expected behavior? Is there a way to configure it so that it
doesn't do this?

Currently, the client is being required to use HTML.decode() to fix it, but
they would rather not?

Any insight is appreciated (in advance)

Thanks,
geo

(I posted this question earlier, but it seems to have disappeared into the
ether - sorry if it is a repost)
Nov 21 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
> We have a web service that returns a string which happens to be well
formed
XML. The client sees the string ok, except the angle brackets are HTML
encoded ( &gt and &lt ).

Is this expected behavior?
Yes. You told the framework you wanted a string, not XML. The framework had
no way to know your string contained well formed XML, so it's only option is
to encode it to ensure it doesn't generate an invalid SOAP message.
Is there a way to configure it so that it
doesn't do this?


Sure. Don't use a String. Use an XmlDocument or XmlNode as the type in the
WebMethod declaration.

--
Tomas Restrepo
to****@mvps.org
Nov 21 '05 #2

P: n/a
Thanks Tomas!

Made your recommended change from a return type of String to XmlDocument and
not only are the angle brackets back, but the output is very nicely
formatted.

Thanks again,
George

"Tomas Restrepo (MVP)" <to****@mvps.org> wrote in message
news:u7*************@TK2MSFTNGP10.phx.gbl...
We have a web service that returns a string which happens to be well formed
XML. The client sees the string ok, except the angle brackets are HTML
encoded ( &gt and &lt ).

Is this expected behavior?


Yes. You told the framework you wanted a string, not XML. The framework

had no way to know your string contained well formed XML, so it's only option is to encode it to ensure it doesn't generate an invalid SOAP message.
Is there a way to configure it so that it
doesn't do this?


Sure. Don't use a String. Use an XmlDocument or XmlNode as the type in the
WebMethod declaration.

--
Tomas Restrepo
to****@mvps.org

Nov 21 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.