Exemplo n.º 1
0
        public static T Parse(XElement messageElement)
        {
            T result;

            XElement faultElement = messageElement.Element("fault");

            if (faultElement != null)
            {
                result       = (T)Activator.CreateInstance(typeof(T));
                result.Fault = FaultResponse.GetFromXml(faultElement);
                CoreLogger.UniqueInstance.Debug(string.Format(" Fault element detected: \nFaultMessage: {0}\nFaultCode: {1}\nRawXML: {2}\nStackTrace:\n{3}", result.Fault.FaultMessage, result.Fault.FaultCode, messageElement, StackTraceHelper.GetCurrentStackTrace()));
            }
            else
            {
                result = RPCCommand.GetInstance <T>(messageElement.Element("params"));
            }

            return(result);
        }