Esempio n. 1
0
        /// <summary>
        /// Builds a broken out LegionReply off of the reaw xml return
        /// </summary>
        /// <param name="sReply">the string of the sReply</param>
        /// <returns>a new LegionReply</returns>
        public static LegionReply <XmlElement> BuildLegionXmlReply(string sReply)
        {
            LegionFault fault = null;

            XmlDocument reply = new XmlDocument();

            reply.LoadXml(sReply);

            XmlElement result   = (XmlElement)reply.SelectSingleNode("/reply/result");
            XmlElement response = (XmlElement)reply.SelectSingleNode("/reply/response");

            XmlElement xFault = (XmlElement)reply.SelectSingleNode("/reply/response/fault");

            if (xFault != null)
            {
                fault = new LegionFault(xFault.InnerText, xFault.Attributes["type"].Value);
            }

            LegionError error = (reply.SelectSingleNode("/reply/error") == null ? null : new LegionError(reply.SelectSingleNode("/reply/error")));

            DateTime?dtCached  = null;
            DateTime?dtExpires = null;

            if (reply.SelectSingleNode("/reply/response/cachedresult") != null)
            {
                dtCached  = DateTime.Parse(reply.SelectSingleNode("/reply/response/cachedresult/updated").InnerText);
                dtExpires = DateTime.Parse(reply.SelectSingleNode("/reply/response/cachedresult/expires").InnerText);
            }

            return(new LegionReply <XmlElement>(response, result, fault, error, dtCached, dtExpires));
        }
Esempio n. 2
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="response">The response node of the Legion Reply</param>
 /// <param name="result">The result node of the Legion Reply</param>
 /// <param name="fault">The fault (if one occurred)</param>
 /// <param name="error">The error (if one occurred)</param>
 /// <param name="CachedOn">If cached, the DateTime the reply was cached</param>
 /// <param name="CachedOn">If cached, the DateTime the reply expires</param>
 internal LegionReply(XmlElement response, XmlElement result, LegionFault fault, LegionError error, DateTime?CachedOn, DateTime?ExpiresOn)
 {
     _response  = (Format)response;
     _result    = (Format)result;
     _fault     = fault;
     _error     = error;
     _dtCached  = CachedOn;
     _dtExpires = ExpiresOn;
 }
Esempio n. 3
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="response">The response node of the Legion Reply</param>
 /// <param name="result">The result node of the Legion Reply</param>
 /// <param name="fault">The fault (if one occurred)</param>
 /// <param name="error">The error (if one occurred)</param>
 /// <param name="CachedOn">If cached, the DateTime the reply was cached</param>
 /// <param name="CachedOn">If cached, the DateTime the reply expires</param>
 public LegionReply(Format response, Format result, LegionFault fault, LegionError error, DateTime?CachedOn, DateTime?ExpiresOn)
 {
     _response  = response;
     _result    = result;
     _fault     = fault;
     _error     = error;
     _dtCached  = CachedOn;
     _dtExpires = ExpiresOn;
 }
 public LegionServiceErrorException(LegionError error) : base(error.Friendly)
 {
     _error = error;
 }