error when passing XML doc to web service

Discussion in 'ASP .Net Web Services' started by Marlon Baskin, Aug 19, 2003.

  1. 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!
    Marlon Baskin, Aug 19, 2003
    #1
    1. Advertising

  2. 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" <> skrev i meddelandet
    news:0e2701c36661$155e7a80$...
    > 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!
    Daniel Johansson, Aug 20, 2003
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. John Wallace
    Replies:
    0
    Views:
    456
    John Wallace
    Jul 22, 2003
  2. Matt
    Replies:
    3
    Views:
    477
    Tor Iver Wilhelmsen
    Sep 17, 2004
  3. Praveen Chhangani

    Converting a org.jdom DOC to org.w3c DOC

    Praveen Chhangani, Aug 5, 2003, in forum: XML
    Replies:
    2
    Views:
    947
    Johannes Koch
    Aug 7, 2003
  4. News123
    Replies:
    0
    Views:
    284
    News123
    Feb 6, 2010
  5. kazaam
    Replies:
    3
    Views:
    127
    Logan Capaldo
    Oct 6, 2007
Loading...

Share This Page