• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 222
  • Last Modified:

Send xml from Web Service response


I developed a web service method whos response is in the code section below.  How can I send a xmlDocument back from the web service?  When I try to access the method locally it says the return type is an XmlNode instead of XmlDocument which the method returns.

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
    <GetBoatByIDResponse xmlns="http://.com/">

Open in new window

2 Solutions
Gorkem YukselCommented:
Can you post the code for the function you are calling?

Basically, in the function, if you set the return type to be XmlDocument, that is the type of object it will return.  

public XmlDocument SomeMethod()
     XmlDocument xmlDoc = new XmlDocument();
     return xmlDoc;

You can have reference to the following url

HOW TO: Use XmlDocument Elements When Passed to or Returned from WebMethods by Using Visual C# .NET
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

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