all groups > dotnet web services > june 2004 >
You're in the

dotnet web services

group:

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


Web Services returns string: which is XML and the angle brackets are encoded? DotNetGruven
6/28/2004 6:01:16 PM
dotnet web services:
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)

Re: Web Services returns string: which is XML and the angle brackets are encoded? Tomas Restrepo (MVP)
6/29/2004 5:56:21 AM
[quoted text, click to view]

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.

[quoted text, click to view]

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

--
Tomas Restrepo
tomasr@mvps.org

Re: Web Services returns string: which is XML and the angle brackets are encoded? DotNetGruven
6/29/2004 10:52:05 AM
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

[quoted text, click to view]

AddThis Social Bookmark Button