Exemplo n.º 1
0
        public ApiResponse GetResponseFromXml(string xml)
        {
            ApiResponse response = new ApiResponse();

            XmlDocument doc = new XmlDocument();

            doc.LoadXml(xml);

            XmlNode root = doc.LastChild;

            if (root.HasChildNodes)
            {
                response.ErrorCode    = ((ApiErrorCode)Enum.ToObject(typeof(YMSDK.ApiErrorCode), Toolkit.ConvertToInt32(root.GetChildNodeValue("ErrCode"))));
                response.ErrorMessage = Toolkit.ConvertToString(root.GetChildNodeValue("ErrDesc"));

                if (!root.LastChild.Name.Equals("XmlRequest"))
                {
                    response.MethodResults = GetMethodResultsFromNode(root.LastChild);
                }
            }

            return(response);
        }