Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / Web Services / June 2004

Tip: Looking for answers? Try searching our database.

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

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
DotNetGruven - 28 Jun 2004 23:01 GMT
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)
Tomas Restrepo \(MVP\) - 29 Jun 2004 11:56 GMT
> 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.

Signature

Tomas Restrepo
tomasr@mvps.org

DotNetGruven - 29 Jun 2004 15:52 GMT
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

> > We have a web service that returns a string which happens to be well
> formed
[quoted text clipped - 12 lines]
> Sure. Don't use a String. Use an XmlDocument or XmlNode as the type in the
> WebMethod declaration.

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.