WebServices中有关返回XmlDocument
#region Overring Order [WebMethod] public XmlDocument Transight_OverringOrder(int chkseq) { XmlDocument xd = new XmlDocument(); try { string xmlStr = string.Empty; bool blnIsChkExist; OverringOrderReturn objOOR = new OverringOrderReturn(); PTIManager ptiM = new PTIManager(); objOOR = ptiM.OverringOrder(chkseq, out blnIsChkExist); if (objOOR == null) { string xml = string.Empty; if (!blnIsChkExist) { xml = "<OverringOrder>Check not exist!</OverringOrder>"; } else { xml = "<OverringOrder>Check is open!</OverringOrder>"; } xd.LoadXml(xml); } else { xmlStr = Transight.PTI.BLL.XmlSerialize.Serialize<OverringOrderReturn>(objOOR); xd.LoadXml(xmlStr); } } catch (Exception ex) { AppLog.Instance.Write("Transight_OverringOrder", AppLog.LogMessageType.Error, ex, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); } return xd; } #endregion
引用此Web Service方法会返回XmlElement.
<webServices> <protocols> <add name ="HttpGet"/> <add name="HttpPost"/> </protocols> </webServices>
如果在Web.config加上如上配置,返回值将会变成XmlNode
Any fool can write code that a computer can understand. Good programmers write code that humans can understand. –Martin Fowler
作者:『Gerry Ge』
本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文链接,否则保留追究法律责任的权利。