Returning XmlDocuments From a Webservice

G

Graham Lloyd

Hi there

I have an Excel Com Add-In that has a web reference to Data Access Web
Service. This service is used also by another web app via client script and
the webservice.htc file.

All the public functions in the web service return System.Xml.XmlDocuments
and has worked fine until I use one in my Com Add-In. The App seems convined
the web service is trying to return System.Xml.XmlNode. If I navigate to the
function in the reference.cs its return type is XmlNode. If I change it to
XmlDocument it all works fine, but then each time I update the web reference
it changes back to XmlNode.

I'm fairly new to .NET and especially COM Add-Ins. Is there something I am
missing here?

TIA

Graham
 
J

Josh Einstein

Actually ASP.NET will always show the type as XML Node because technically,
it can't return a document because a document is a standalone xml entity and
since the response has to live within an XML envelope, it will be typed as an
XML node.

What you can do however, is in your client, create a nw XmlDocument then use
the LoadXml method to load the OuterXml of the XmlNode that you got back.
 
G

Graham Lloyd

Ah I see, that does make sense.

thanks

Josh Einstein said:
Actually ASP.NET will always show the type as XML Node because
technically,
it can't return a document because a document is a standalone xml entity
and
since the response has to live within an XML envelope, it will be typed as
an
XML node.

What you can do however, is in your client, create a nw XmlDocument then
use
the LoadXml method to load the OuterXml of the XmlNode that you got back.
 

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

Top