Esempio n. 1
0
        public static XmlDocument CheckHeaders(XmlDocument xmlDoc)
        {
            XmlElement envelope     = xmlDoc.DocumentElement;
            XmlElement headerOrBody = (XmlElement)envelope.ChildNodes[0];
            XmlElement header       = null;
            XmlElement body         = null;

            if (headerOrBody.LocalName == Elem.Header)
            {
                header = (XmlElement)envelope.ChildNodes[0];
                body   = (XmlElement)envelope.ChildNodes[1];
            }
            else             //no header
            {
                body = (XmlElement)envelope.ChildNodes[0];
            }

            if (header != null)
            {
                XmlElement tsElem = LameXpath.SelectSingleNode(header, Elem.Timestamp);
                if (tsElem != null)
                {
                    XmlElement creElem = LameXpath.SelectSingleNode(tsElem, Elem.Created);
                    XmlElement expElem = LameXpath.SelectSingleNode(tsElem, Elem.Expires);
                    string     cre     = creElem.InnerText;
                    string     exp     = expElem.InnerText;

                    if (exp.CompareTo(cre) == -1)                    //less than
                    {
                        throw new Exception("Timestamp expired before creation");
                    }
                    bool retVal = TimestampHeader.IsExpired(exp);
                    if (retVal == true)
                    {
                        throw new Exception("response TimeStamp is expired");
                    }
                }
            }

            return(xmlDoc);
        }
Esempio n. 2
0
        public bool IsExpired()
        {
            bool retVal = TimestampHeader.IsExpired(Expires.text);

            return(retVal);
        }