[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.aspnet.webservices

error when passing XML doc to web service

Marlon Baskin

8/19/2003 2:49:00 PM

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!
1 Answer

Daniel Johansson

8/20/2003 2:30:00 PM

0

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
"Marlon Baskin" <marlon.baskin@turner.com> skrev i meddelandet
news:0e2701c36661$155e7a80$a501280a@phx.gbl...
> 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!