I see that I can set the return type of the method in an XmlDocument. This seems to work.
[WebMethod]
public XmlDocument ReturnXml()
{
XmlDocument dom = new XmlDocument();
XmlElement people = dom.CreateElement("People");
dom.AppendChild(people);
XmlElement person = dom.CreateElement("Person");
people.AppendChild(person);
XmlElement firstName = dom.CreateElement("FirstName");
person.AppendChild(firstName);
XmlText text = dom.CreateTextNode("Bob");
firstName.AppendChild(text);
return dom;
}
source
share