XMLDocument to XMLNode

D

Dave T

I have a web service method that returns an XMLDocument. When I call it from
an aspx page, the intellisense says that the method is of type XMLNode, so
when I try, stupidly, to get the results of the web service call into an
XMLDocument in the client, it fails with the error

System.Web.Services.Protocols.SoapException: Server was unable to process
request. ---> System.InvalidCastException: Unable to cast object of type
'System.Xml.XmlElement' to type 'System.Xml.XmlDocument'.

Does anyone know where I might find out more about this?

Thanks
 
M

Martin Honnen

Dave said:
I have a web service method that returns an XMLDocument. When I call it from
an aspx page, the intellisense says that the method is of type XMLNode, so
when I try, stupidly, to get the results of the web service call into an
XMLDocument in the client, it fails with the error

System.Web.Services.Protocols.SoapException: Server was unable to process
request. ---> System.InvalidCastException: Unable to cast object of type
'System.Xml.XmlElement' to type 'System.Xml.XmlDocument'.

Does anyone know where I might find out more about this?

As the error message says what the web service returns is an XmlElement
not an XmlDocument. If you want to access an XmlDocument take that node
and use its OwnerDocument property which is of type XmlDocument.
 

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

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,013
Latest member
KatriceSwa

Latest Threads

Top