error when passing XML doc to web service

M

Marlon Baskin

I built a web service that accepts an XML document of type
System.XML.XMLDocument and returns an XML document of the
same type. But when I pass the XML document to the web
service from a client app it throws an
InvalidCastException:

An unhandled exception of
type 'System.Web.Services.Protocols.SoapException'
occurred in system.web.services.dll

Additional information: Server was unable to read
request. --> There is an error in XML document (1, 375). --
Specified cast is not valid.

Is the System.XML.XMLDocument class not a valid type for
passing to web services? Is there a better way to pass
weak-typed XML to the web service (other than just passing
it as a string)? Any help would be appreciated. Thanks!
 
D

Daniel Johansson

Hello

Have you tried to put the xmlDocument inside a dataset instead?
DataSet.ReadXml("nameofxml");
or pass the document as an XmlElement
XmlDocument.DocumentElement;
// Daniel
 

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,776
Messages
2,569,603
Members
45,189
Latest member
CryptoTaxSoftware

Latest Threads

Top