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 / November 2004

Tip: Looking for answers? Try searching our database.

XmlDocument Web method returns type XmlNode

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
John Bailo - 22 Oct 2004 18:54 GMT
I developed a web method that returns type XmlDocument.

But a client calling the web method will only accept the return value as
datatype XmlNode.

Why?

Signature

http://antimeme.texeme.com

James Flynn - 22 Oct 2004 19:03 GMT
Could be that the client doesn't want the entire xmlDocument.
Change the return type to xmlNode

Then, take your existing xmlDocument and add the following to be returned:
xmlDocument.SelectSingleNode(XPath Expression Goes Here)

> I developed a web method that returns type XmlDocument.
>
> But a client calling the web method will only accept the return value as
> datatype XmlNode.
>
> Why?
John Bailo - 25 Oct 2004 21:26 GMT
> Could be that the client doesn't want the entire xmlDocument.
> Change the return type to xmlNode
>
> Then, take your existing xmlDocument and add the following to be returned:
> xmlDocument.SelectSingleNode(XPath Expression Goes Here)

Yes, I can read it via workarounds.

It just disturbs me that an explicitly typed complex return type
XmlDocument is translated to a completely different type when creating
the web reference in the client (!)

>>I developed a web method that returns type XmlDocument.
>>
>>But a client calling the web method will only accept the return value as
>>datatype XmlNode.
>>
>>Why?

Signature

http://antimeme.texeme.com

Dan Rogers - 15 Nov 2004 23:56 GMT
Hi John,

In general, if you really want to return raw XML to the client, as opposed
to normal classes or .NET based native data types, try and use XmlNode as
the return type when coding an ASP.NET webMethod.  The reason is that the
return data comes from the first element child from the SOAP:Body element -
and thus won't be a complete document.  If you really want to make a pure
XML document based interface, use simple ASP and the DOM, instead of
ASP.Net.  This is the case when you want to include processing instructions
that point to XSLT, etc).  Otherwise, if you are simply on the
green-diamond slopes and wanting to return plain old XML, just use XmlNode
instead of the DOM.  You can still use the DOM to build your response, and
then peel off the node you want to return (you can only return one!).

Hope this helps,

Dan Rogers
Microsoft Corporation

--------------------
>From: John Bailo <jabailo@earthlink.net>
>Newsgroups:
microsoft.public.dotnet.framework.aspnet.webservices,microsoft.public.dotnet
general,microsoft.public.dotnet.languages.csharp
>Subject: XmlDocument Web method returns type XmlNode
>Date: Fri, 22 Oct 2004 10:54:22 -0700
[quoted text clipped - 4 lines]
>Content-Transfer-Encoding: 7bit
>X-Trace: news.uni-berlin.de
3LpxG5/QqYUFUyGyb/WBPw0wNdqJiK5DPPYt/mZzRHDfDoJ4D2
>User-Agent: Mozilla Thunderbird 0.7.3 (Windows/20040803)
>X-Accept-Language: en-us, en
>Path:
cpmsftngxa10.phx.gbl!TK2MSFTNGXA01.phx.gbl!cpmsftngxa06.phx.gbl!TK2MSFTNGP08
phx.gbl!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!f
u-berlin.de!uni-berlin.de!not-for-mail
>Xref: cpmsftngxa10.phx.gbl microsoft.public.dotnet.general:149951
microsoft.public.dotnet.languages.csharp:281723
microsoft.public.dotnet.framework.aspnet.webservices:26210
>X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webservices
>
[quoted text clipped - 4 lines]
>
>Why?

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.