Loading

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

 

posted @ 2013-05-20 19:28  GerryGe  阅读(681)  评论(0编辑  收藏  举报