dcidral dcidral - 1 year ago 101
C# Question

.net webservice with XElement return type

There is a way to make a webservice that returns a parameter of the type XElement?
Now I'm working with XmlNode return type, but I want to get rid of using this old xml library.

I'm using this:

XDocument doc = new XDocument();
XElement xml = new XElement("produtos");

var xmlDoc = new XmlDocument();
using (var xmlReader = doc.CreateReader())
return xmlDoc;

I can't figure out why the webservice dont work with the XmlLinq lib

Answer Source

You should be able to do this:

[ScriptMethod(ResponseFormat = ResponseFormat.Xml)]
public XElement GetSomething()
    return new XElement("Something");
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download