如何从WCF服务返回XMLDocument [英] How to return XMLDocument from WCF Service
本文介绍了如何从WCF服务返回XMLDocument的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
public XmlDocument GetDocumentStructure()
{
//throw new NotImplementedException();
}
推荐答案
Web服务/ WCF服务本身以SOAP消息的形式返回XML文档,因此您无法在其中返回XML文档。所以你必须使用XmlElement。
Web service/WCF service itself return a XML document in form SOAP message so you cannot return XML document in it. So you will have to use XmlElement.
[WebMethod(Descrption = "Return XML document")]
public XmlElement GetXMLDoc(string documentName)
{
XmlDocument doc = new XmlDocument();
doc.LoadXml("<xDoc> <xElement xE="Value"/> </xDoc>");
return doc.DocumentElement();
}
这篇关于如何从WCF服务返回XMLDocument的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文