[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 468
  • Last Modified:

How to receive an XmlDocument in Web Service

I want to have a web service that receives an xml document, does stuff and returns an xml document. The working code I have receives the xml as a string, and then returns a string.
(I guess my problem is how to read an xml document.)
How to I receive and reply with an xml document?

This works.....but it is based on STRING not XmlDocument
    <WebMethod()> _
    Public Function GetXml(ByVal thisXmlDoc As String) As String
            Dim ResponseXML as string = ""
            Dim sr As New StringReader(thisXmlDoc)
            Dim xmlReader As New XmlTextReader(sr)
            xmlReader.WhitespaceHandling = WhitespaceHandling.None
            While xmlReader.Read()
            ....do stuff
        Return ResponseXML
    End Function

I really want to do this with Xml documents
    <WebMethod()> _
    Public Function GetXml(ByVal thisXmlDoc As XmlDocument) As XmlDocument
            Dim ResponseXML as XmlDocument
            Dim sr As New StringReader(thisXmlDoc)  <--- error: string reader cannot read xml doc
            Dim xmlReader As New XmlTextReader(sr)
            xmlReader.WhitespaceHandling = WhitespaceHandling.None
            While xmlReader.Read()
            ....do stuff
        Return ResponseXML
    End Function




0
MikeCombe
Asked:
MikeCombe
1 Solution
 
DarrenDCommented:
0
 
MikeCombeAuthor Commented:
does not address my issue
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now