Exemplo n.º 1
0
        private IBasicOutput CreateReturnValue(SoapMessage message)
        {
            Exception ex     = Misc.GetDeepestInnerException(message.Exception);
            var       ret    = Utilities.Reflection.CreateInstance(message.MethodInfo.ReturnType);
            var       output = ret as Schemas.Part.IBasicOutput;

            if (ex is XmlException)
            {
                output.StandardRetur = StandardReturType.MalformedXml();
            }
            else if (ex is HeaderException)
            {
                output.StandardRetur = StandardReturType.NullInput("applicationHeader");
            }
            else if (ex is MissingRequestException)
            {
                output.StandardRetur = StandardReturType.Create(HttpErrorCode.BAD_CLIENT_REQUEST, string.Format("Missing request element: {0}", message.MethodInfo.Name));
            }
            else if (ex is InvalidOperationException && Misc.ExceptionTreeContainsText(message.Exception, "XML"))
            {
                output.StandardRetur = StandardReturType.RequestUnreadable(ex.Message);
            }
            else
            {
                output.StandardRetur = StandardReturType.UnspecifiedError();
            }
            return(output);
        }