示例#1
0
 // helper function that allows us to pass dummy subCodes around but clear them before they get to the user
 internal void ClearSubCode()
 {
     if (subCode != null)
     {
         subCode = subCode.SubCode;
     }
 }
 internal void ClearSubCode()
 {
     if (this.subCode != null)
     {
         this.subCode = this.subCode.SubCode;
     }
 }
示例#3
0
 /// <include file='doc\SoapException.uex' path='docs/doc[@for="SoapException.SoapException7"]/*' />
 /// <devdoc>
 ///    <para>[To be supplied.]</para>
 /// </devdoc>
 public SoapException(string message, XmlQualifiedName code, string actor, string role, System.Xml.XmlNode detail, SoapFaultSubCode subCode, Exception innerException) : base(message, innerException)
 {
     this.code    = code;
     this.actor   = actor;
     this.role    = role;
     this.detail  = detail;
     this.subCode = subCode;
 }
 protected SoapException(SerializationInfo info, StreamingContext context) : base(info, context)
 {
     this.code = XmlQualifiedName.Empty;
     IDictionary data = base.Data;
     this.code = (XmlQualifiedName) data["code"];
     this.actor = (string) data["actor"];
     this.role = (string) data["role"];
     this.subCode = (SoapFaultSubCode) data["subCode"];
     this.lang = (string) data["lang"];
 }
示例#5
0
 protected SoapException(SerializationInfo info, StreamingContext context)
     : base(info, context)
 {
     actor  = info.GetString("actor");
     code   = (XmlQualifiedName)info.GetValue("code", typeof(XmlQualifiedName));
     detail = new XmlDocument().ReadNode(
         XmlReader.Create(new StringReader(info.GetString("detailString"))));
     lang    = info.GetString("lang");
     role    = info.GetString("role");
     subcode = (SoapFaultSubCode)info.GetValue("subcode", typeof(SoapFaultSubCode));
 }
        protected SoapException(SerializationInfo info, StreamingContext context) : base(info, context)
        {
            this.code = XmlQualifiedName.Empty;
            IDictionary data = base.Data;

            this.code    = (XmlQualifiedName)data["code"];
            this.actor   = (string)data["actor"];
            this.role    = (string)data["role"];
            this.subCode = (SoapFaultSubCode)data["subCode"];
            this.lang    = (string)data["lang"];
        }
示例#7
0
        public SoapHeaderException(
            string message,
            XmlQualifiedName code,
            string actor,
            string role,
            SoapFaultSubCode subcode,
            Exception innerException)

            : base(message, code, actor, role, null, subcode, innerException)
        {
        }
示例#8
0
		public SoapHeaderException (
			string message, 
			XmlQualifiedName code, 
			string actor, 
			string role, 
			SoapFaultSubCode subcode, 
			Exception innerException)
			
		: base (message, code, actor, role, null, subcode, innerException)
		{
			
		}
示例#9
0
        private XmlQualifiedName ReadSoap12FaultCode(XmlReader reader, out SoapFaultSubCode subcode)
        {
            SoapFaultSubCode code = this.ReadSoap12FaultCodesRecursive(reader, 0);

            if (code == null)
            {
                subcode = null;
                return(null);
            }
            subcode = code.SubCode;
            return(code.Code);
        }
        private SoapFaultSubCode ReadSoap12FaultCodesRecursive(XmlReader reader, int depth)
        {
            if (depth > 100)
            {
                return(null);
            }
            if (reader.IsEmptyElement)
            {
                reader.Skip();
                return(null);
            }
            XmlQualifiedName code    = null;
            SoapFaultSubCode subcode = null;
            int faultDepth           = reader.Depth;

            reader.ReadStartElement();
            reader.MoveToContent();
            while (reader.NodeType != XmlNodeType.EndElement && reader.NodeType != XmlNodeType.None)
            {
                if (reader.NamespaceURI == Soap12.Namespace || reader.NamespaceURI == null || reader.NamespaceURI.Length == 0)
                {
                    if (reader.LocalName == Soap12.Element.FaultCodeValue)
                    {
                        code = ReadFaultCode(reader);
                    }
                    else if (reader.LocalName == Soap12.Element.FaultSubcode)
                    {
                        subcode = ReadSoap12FaultCodesRecursive(reader, depth + 1);
                    }
                    else
                    {
                        reader.Skip();
                    }
                }
                else
                {
                    reader.Skip();
                }
                reader.MoveToContent();
            }
            // Consume closing tag
            while (faultDepth < reader.Depth && reader.Read())
            {
                // Nothing, just read on
            }
            // consume end tag
            if (reader.NodeType == XmlNodeType.EndElement)
            {
                reader.Read();
            }

            return(new SoapFaultSubCode(code, subcode));
        }
示例#11
0
 private SoapFaultSubCode ReadSoap12FaultCodesRecursive(XmlReader reader, int depth)
 {
     if (depth > 100)
     {
         return((SoapFaultSubCode)null);
     }
     if (reader.IsEmptyElement)
     {
         reader.Skip();
         return((SoapFaultSubCode)null);
     }
     else
     {
         XmlQualifiedName code    = (XmlQualifiedName)null;
         SoapFaultSubCode subCode = (SoapFaultSubCode)null;
         int depth1 = reader.Depth;
         reader.ReadStartElement();
         int num1 = (int)reader.MoveToContent();
         while (reader.NodeType != XmlNodeType.EndElement && reader.NodeType != XmlNodeType.None)
         {
             if (reader.NamespaceURI == "http://www.w3.org/2003/05/soap-envelope" || reader.NamespaceURI == null || reader.NamespaceURI.Length == 0)
             {
                 if (reader.LocalName == "Value")
                 {
                     code = this.ReadFaultCode(reader);
                 }
                 else if (reader.LocalName == "Subcode")
                 {
                     subCode = this.ReadSoap12FaultCodesRecursive(reader, depth + 1);
                 }
                 else
                 {
                     reader.Skip();
                 }
             }
             else
             {
                 reader.Skip();
             }
             int num2 = (int)reader.MoveToContent();
         }
         do
         {
             ;
         }while (depth1 < reader.Depth && reader.Read());
         if (reader.NodeType == XmlNodeType.EndElement)
         {
             reader.Read();
         }
         return(new SoapFaultSubCode(code, subCode));
     }
 }
示例#12
0
 internal static SoapException Create(SoapProtocolVersion soapVersion, string message, XmlQualifiedName code,
                                      string actor, string role, System.Xml.XmlNode detail,
                                      SoapFaultSubCode subCode, Exception innerException)
 {
     if (System.Web.Services.Configuration.WebServicesSection.Current.Diagnostics.SuppressReturningExceptions)
     {
         return(CreateSuppressedException(soapVersion, Res.GetString(Res.WebSuppressedExceptionMessage), innerException));
     }
     else
     {
         return(new SoapException(message, code, actor, role, detail, subCode, innerException));
     }
 }
        public static SoapException WOFExceptionToSoapException(Exception ex)
        {
            Type eType = ex.GetType();
            SoapException se;
            String actor = null;
            String detailText = null;
            string message = null;
            if (eType == typeof (WaterOneFlowException))
            {
                XmlQualifiedName soapCode = ClientFaultCode;
                se = new SoapException(ex.Message, soapCode);
                if (log.IsDebugEnabled) log.Debug(ex.Message);
            }
            else if (eType == typeof (WaterOneFlowSourceException))
            {
                XmlQualifiedName soapCode = ServerFaultCode;
                se = new SoapException(ex.Message, soapCode);
                if (log.IsErrorEnabled) log.Error(ex.Message);
            }
            else if (eType == typeof (WaterOneFlowServerException))
            {
                // create a soap fault with a subcode, external
                XmlQualifiedName soapCode = ServerFaultCode;
                XmlQualifiedName subCodeName = new XmlQualifiedName("external",Constants.XML_SCHEMA_NAMSPACE);
                SoapFaultSubCode subCode = new SoapFaultSubCode(subCodeName);

                se = new SoapException(ex.Message, soapCode, subCode);
                if (log.IsErrorEnabled) log.Error(ex.Message);

            }
             else if (eType == typeof(ArgumentException))
             {
             XmlQualifiedName soapCode = ClientFaultCode;
             se = new SoapException(ex.Message, soapCode);
             if (log.IsDebugEnabled) log.Debug(ex.Message);
             } else if (eType == typeof(OverflowException))
             {
             XmlQualifiedName soapCode = ServerFaultCode;
             se = new SoapException(ex.Message, soapCode);
             if (log.IsErrorEnabled) log.Error(ex.Message);
             }

            else
               {
               XmlQualifiedName soapCode = ServerFaultCode;
               se = new SoapException(ex.Message, soapCode);
               if (log.IsErrorEnabled) log.Error(ex.Message);
               }
            return se;
        }
示例#14
0
        private SoapFaultSubCode ReadSoap12FaultCodesRecursive(XmlReader reader, int depth)
        {
            if (depth > 100)
            {
                return(null);
            }
            if (reader.IsEmptyElement)
            {
                reader.Skip();
                return(null);
            }
            XmlQualifiedName name    = null;
            SoapFaultSubCode subCode = null;
            int num = reader.Depth;

            reader.ReadStartElement();
            reader.MoveToContent();
            while ((reader.NodeType != XmlNodeType.EndElement) && (reader.NodeType != XmlNodeType.None))
            {
                if (((reader.NamespaceURI == "http://www.w3.org/2003/05/soap-envelope") || (reader.NamespaceURI == null)) || (reader.NamespaceURI.Length == 0))
                {
                    if (reader.LocalName == "Value")
                    {
                        name = this.ReadFaultCode(reader);
                    }
                    else if (reader.LocalName == "Subcode")
                    {
                        subCode = this.ReadSoap12FaultCodesRecursive(reader, depth + 1);
                    }
                    else
                    {
                        reader.Skip();
                    }
                }
                else
                {
                    reader.Skip();
                }
                reader.MoveToContent();
            }
            while ((num < reader.Depth) && reader.Read())
            {
            }
            if (reader.NodeType == XmlNodeType.EndElement)
            {
                reader.Read();
            }
            return(new SoapFaultSubCode(name, subCode));
        }
示例#15
0
        static Soap12FaultCode CreateFaultCode(SoapFaultSubCode code)
        {
            if (code == null)
            {
                throw new ArgumentNullException("code");
            }
            Soap12FaultCode ret = new Soap12FaultCode();

            ret.Value = code.Code;
            if (code.SubCode != null)
            {
                ret.Subcode = CreateFaultCode(code.SubCode);
            }
            return(ret);
        }
        protected SoapException(SerializationInfo info, StreamingContext context) : base(info, context)
        {
            IDictionary list = base.Data;

            code  = (XmlQualifiedName)list["code"];
            actor = (string)list["actor"];
            role  = (string)list["role"];

            // Bug: 323493: XmlNode is not serializable, and I don't think we want to really want to create
            // an XmlDocument just to read a XmlNode from string to get the deserialized instance back.
            // detail = (XmlNode)list["detail"];

            subCode = (SoapFaultSubCode)list["subCode"];
            lang    = (string)list["lang"];
        }
示例#17
0
        protected SoapException(SerializationInfo info, StreamingContext context) : base(info, context)
        {
            IDictionary list = base.Data;

            code  = (XmlQualifiedName)list["code"];
            actor = (string)list["actor"];
            role  = (string)list["role"];

            //



            subCode = (SoapFaultSubCode)list["subCode"];
            lang    = (string)list["lang"];
        }
示例#18
0
        private XmlQualifiedName ReadSoap12FaultCode(XmlReader reader, out SoapFaultSubCode subcode)
        {
            SoapFaultSubCode soapFaultSubCode = this.ReadSoap12FaultCodesRecursive(reader, 0);

            if (soapFaultSubCode == null)
            {
                subcode = (SoapFaultSubCode)null;
                return((XmlQualifiedName)null);
            }
            else
            {
                subcode = soapFaultSubCode.SubCode;
                return(soapFaultSubCode.Code);
            }
        }
示例#19
0
        public static SoapException Soap12FaultToSoapException(Soap12Fault fault)
        {
            Soap12FaultReasonText text =
                fault.Reason != null &&
                fault.Reason.Texts != null &&
                fault.Reason.Texts.Length > 0 ?
                fault.Reason.Texts [fault.Reason.Texts.Length - 1] : null;
            XmlNode detail = (fault.Detail == null) ? null :
                             (fault.Detail.Children != null &&
                              fault.Detail.Children.Length > 0) ?
                             (XmlNode)fault.Detail.Children [0] :
                             (fault.Detail.Attributes != null &&
                              fault.Detail.Attributes.Length > 0) ?
                             fault.Detail.Attributes [0] : null;
            SoapFaultSubCode subcode = Soap12Fault.GetSoapFaultSubCode(fault.Code.Subcode);

            return(new SoapException(
                       text != null ? text.Value : null,
                       fault.Code.Value, null, fault.Role,
                       text != null ? text.XmlLang : null,
                       detail, subcode, null));
        }
 /// <include file='doc\SoapFaultCodes.uex' path='docs/doc[@for="SoapFaultSubCode.SoapFaultSubCode1"]/*' />
 public SoapFaultSubCode(XmlQualifiedName code, SoapFaultSubCode subCode) {
     this.code = code;
     this.subCode = subCode;
 }
示例#21
0
        private SoapException ReadSoapException(XmlReader reader)
        {
            XmlQualifiedName empty   = XmlQualifiedName.Empty;
            string           message = null;
            string           actor   = null;
            string           role    = null;
            XmlNode          detail  = null;
            SoapFaultSubCode subcode = null;
            string           lang    = null;
            bool             flag    = reader.NamespaceURI == "http://www.w3.org/2003/05/soap-envelope";

            if (reader.IsEmptyElement)
            {
                reader.Skip();
            }
            else
            {
                reader.ReadStartElement();
                reader.MoveToContent();
                int depth = reader.Depth;
                while ((reader.NodeType != XmlNodeType.EndElement) && (reader.NodeType != XmlNodeType.None))
                {
                    if (((reader.NamespaceURI == "http://schemas.xmlsoap.org/soap/envelope/") || (reader.NamespaceURI == "http://www.w3.org/2003/05/soap-envelope")) || ((reader.NamespaceURI == null) || (reader.NamespaceURI.Length == 0)))
                    {
                        if ((reader.LocalName == "faultcode") || (reader.LocalName == "Code"))
                        {
                            if (flag)
                            {
                                empty = this.ReadSoap12FaultCode(reader, out subcode);
                            }
                            else
                            {
                                empty = this.ReadFaultCode(reader);
                            }
                        }
                        else if (reader.LocalName == "faultstring")
                        {
                            lang = reader.GetAttribute("lang", "http://www.w3.org/XML/1998/namespace");
                            reader.MoveToElement();
                            message = reader.ReadElementString();
                        }
                        else if (reader.LocalName == "Reason")
                        {
                            if (reader.IsEmptyElement)
                            {
                                reader.Skip();
                            }
                            else
                            {
                                reader.ReadStartElement();
                                reader.MoveToContent();
                                while ((reader.NodeType != XmlNodeType.EndElement) && (reader.NodeType != XmlNodeType.None))
                                {
                                    if ((reader.LocalName == "Text") && (reader.NamespaceURI == "http://www.w3.org/2003/05/soap-envelope"))
                                    {
                                        message = reader.ReadElementString();
                                    }
                                    else
                                    {
                                        reader.Skip();
                                    }
                                    reader.MoveToContent();
                                }
                                while (reader.NodeType == XmlNodeType.Whitespace)
                                {
                                    reader.Skip();
                                }
                                if (reader.NodeType == XmlNodeType.None)
                                {
                                    reader.Skip();
                                }
                                else
                                {
                                    reader.ReadEndElement();
                                }
                            }
                        }
                        else if ((reader.LocalName == "faultactor") || (reader.LocalName == "Node"))
                        {
                            actor = reader.ReadElementString();
                        }
                        else if ((reader.LocalName == "detail") || (reader.LocalName == "Detail"))
                        {
                            detail = new XmlDocument().ReadNode(reader);
                        }
                        else if (reader.LocalName == "Role")
                        {
                            role = reader.ReadElementString();
                        }
                        else
                        {
                            reader.Skip();
                        }
                    }
                    else
                    {
                        reader.Skip();
                    }
                    reader.MoveToContent();
                }
                while (reader.Read() && (depth < reader.Depth))
                {
                }
                if (reader.NodeType == XmlNodeType.EndElement)
                {
                    reader.Read();
                }
            }
            if ((detail == null) && !flag)
            {
                return(new SoapHeaderException(message, empty, actor, role, lang, subcode, null));
            }
            return(new SoapException(message, empty, actor, role, lang, detail, subcode, null));
        }
 private XmlQualifiedName ReadSoap12FaultCode(XmlReader reader, out SoapFaultSubCode subcode)
 {
   SoapFaultSubCode soapFaultSubCode = this.ReadSoap12FaultCodesRecursive(reader, 0);
   if (soapFaultSubCode == null)
   {
     subcode = (SoapFaultSubCode) null;
     return (XmlQualifiedName) null;
   }
   else
   {
     subcode = soapFaultSubCode.SubCode;
     return soapFaultSubCode.Code;
   }
 }
示例#23
0
		public SoapException (string message, XmlQualifiedName code, string actor, string role, string lang, XmlNode detail, SoapFaultSubCode subcode, Exception innerException)
			: this (message, code, actor, role, detail, subcode, innerException)
		{
			this.lang = lang;
		}
        SoapException ReadSoapException(XmlReader reader)
        {
            XmlQualifiedName faultCode   = XmlQualifiedName.Empty;
            string           faultString = null;
            string           faultActor  = null;
            string           faultRole   = null;
            XmlNode          detail      = null;
            SoapFaultSubCode subcode     = null;
            string           lang        = null;
            bool             soap12      = (reader.NamespaceURI == Soap12.Namespace);

            if (reader.IsEmptyElement)
            {
                reader.Skip();
            }
            else
            {
                reader.ReadStartElement();
                reader.MoveToContent();
                int depth = reader.Depth;
                while (reader.NodeType != XmlNodeType.EndElement && reader.NodeType != XmlNodeType.None)
                {
                    if (reader.NamespaceURI == Soap.Namespace || reader.NamespaceURI == Soap12.Namespace || reader.NamespaceURI == null || reader.NamespaceURI.Length == 0)
                    {
                        if (reader.LocalName == Soap.Element.FaultCode || reader.LocalName == Soap12.Element.FaultCode)
                        {
                            if (soap12)
                            {
                                faultCode = ReadSoap12FaultCode(reader, out subcode);
                            }
                            else
                            {
                                faultCode = ReadFaultCode(reader);
                            }
                        }
                        else if (reader.LocalName == Soap.Element.FaultString)
                        {
                            lang = reader.GetAttribute(Soap.Attribute.Lang, Soap.XmlNamespace);
                            reader.MoveToElement();
                            faultString = reader.ReadElementString();
                        }
                        else if (reader.LocalName == Soap12.Element.FaultReason)
                        {
                            if (reader.IsEmptyElement)
                            {
                                reader.Skip();
                            }
                            else
                            {
                                reader.ReadStartElement(); // consume Reason element to get to Text child
                                reader.MoveToContent();
                                while (reader.NodeType != XmlNodeType.EndElement && reader.NodeType != XmlNodeType.None)
                                {
                                    if (reader.LocalName == Soap12.Element.FaultReasonText && reader.NamespaceURI == Soap12.Namespace)
                                    {
                                        faultString = reader.ReadElementString();
                                    }
                                    else
                                    {
                                        reader.Skip();
                                    }
                                    reader.MoveToContent();
                                }
                                while (reader.NodeType == XmlNodeType.Whitespace)
                                {
                                    reader.Skip();
                                }
                                if (reader.NodeType == XmlNodeType.None)
                                {
                                    reader.Skip();
                                }
                                else
                                {
                                    reader.ReadEndElement();
                                }
                            }
                        }
                        else if (reader.LocalName == Soap.Element.FaultActor || reader.LocalName == Soap12.Element.FaultNode)
                        {
                            faultActor = reader.ReadElementString();
                        }
                        else if (reader.LocalName == Soap.Element.FaultDetail || reader.LocalName == Soap12.Element.FaultDetail)
                        {
                            detail = new XmlDocument().ReadNode(reader);
                        }
                        else if (reader.LocalName == Soap12.Element.FaultRole)
                        {
                            faultRole = reader.ReadElementString();
                        }
                        else
                        {
                            reader.Skip();
                        }
                    }
                    else
                    {
                        reader.Skip();
                    }
                    reader.MoveToContent();
                }
                // Consume soap:Body and soap:Envelope closing tags
                while (reader.Read() && depth < reader.Depth)
                {
                    // Nothing, just read on
                }
                // consume end tag
                if (reader.NodeType == XmlNodeType.EndElement)
                {
                    reader.Read();
                }
            }
            if (detail != null || soap12) // with soap 1.2, can't tell if fault is for header
            {
                return(new SoapException(faultString, faultCode, faultActor, faultRole, lang, detail, subcode, null));
            }
            else
            {
                return(new SoapHeaderException(faultString, faultCode, faultActor, faultRole, lang, subcode, null));
            }
        }
 private XmlQualifiedName ReadSoap12FaultCode(XmlReader reader, out SoapFaultSubCode subcode) {
     SoapFaultSubCode code = ReadSoap12FaultCodesRecursive(reader, 0);
     if (code == null) {
         subcode = null;
         return null;
     }
     else {
         subcode = code.SubCode;
         return code.Code;
     }
 }
示例#26
0
		public SoapException (string message, XmlQualifiedName code, SoapFaultSubCode subcode)
			: base (message)
		{
			this.code = code;
			this.subcode = subcode;
		}
示例#27
0
 /// <summary>Initializes a new instance of the <see cref="T:System.Web.Services.Protocols.SoapFaultSubcode" /> class setting the application specific error code and additional error information.</summary>
 /// <param name="code">An <see cref="T:System.Xml.XmlQualifiedName" /> specifying the application specific error code. Sets the <see cref="P:System.Web.Services.Protocols.SoapFaultSubcode.Code" /> property. </param>
 /// <param name="subCode"></param>
 public SoapFaultSubCode(XmlQualifiedName code, SoapFaultSubCode subCode)
 {
     this.code    = code;
     this.subCode = subCode;
 }
 public static SoapException Create(SoapProtocolVersion soapVersion, string message, XmlQualifiedName code, string actor, string role, XmlNode detail, SoapFaultSubCode subCode, Exception innerException)
 {
     //if (WebServicesSection.Current.Diagnostics.SuppressReturningExceptions)
     //{
     //    return SoapException.CreateSuppressedException(soapVersion, Res.GetString("WebSuppressedExceptionMessage"), innerException);
     //}
     return(new SoapException(message, code, actor, role, detail, subCode, innerException));
 }
示例#29
0
		public SoapFaultSubCode (XmlQualifiedName code, SoapFaultSubCode subcode)
		{
			_code = code;
			_subcode = subcode;
		}
示例#30
0
 private static void WriteFaultCodeValue(XmlWriter writer, XmlQualifiedName code, SoapFaultSubCode subcode)
 {
     if (code == null)
     {
         return;
     }
     writer.WriteStartElement(Soap12.Element.FaultCodeValue, Soap12.Namespace);
     if (code.Namespace != null && code.Namespace.Length > 0 && writer.LookupPrefix(code.Namespace) == null)
     {
         writer.WriteAttributeString("xmlns", "q0", null, code.Namespace);
     }
     writer.WriteQualifiedName(code.Name, code.Namespace);
     writer.WriteEndElement(); // </value>
     if (subcode != null)
     {
         writer.WriteStartElement(Soap12.Element.FaultSubcode, Soap12.Namespace);
         WriteFaultCodeValue(writer, subcode.Code, subcode.SubCode);
         writer.WriteEndElement(); // </subcode>
     }
 }
 private static void WriteFaultCodeValue(XmlWriter writer, XmlQualifiedName code, SoapFaultSubCode subcode)
 {
     if (code != null)
     {
         writer.WriteStartElement("Value", "http://www.w3.org/2003/05/soap-envelope");
         if (((code.Namespace != null) && (code.Namespace.Length > 0)) && (writer.LookupPrefix(code.Namespace) == null))
         {
             writer.WriteAttributeString("xmlns", "q0", null, code.Namespace);
         }
         writer.WriteQualifiedName(code.Name, code.Namespace);
         writer.WriteEndElement();
         if (subcode != null)
         {
             writer.WriteStartElement("Subcode", "http://www.w3.org/2003/05/soap-envelope");
             WriteFaultCodeValue(writer, subcode.Code, subcode.SubCode);
             writer.WriteEndElement();
         }
     }
 }
 // helper function that allows us to pass dummy subCodes around but clear them before they get to the user
 internal void ClearSubCode() {
     if (subCode != null)
         subCode = subCode.SubCode;
 }
 internal static SoapException Create(SoapProtocolVersion soapVersion, string message, XmlQualifiedName code, 
                                                string actor, string role, System.Xml.XmlNode detail,
                                                SoapFaultSubCode subCode, Exception innerException) {
     if (System.Web.Services.Configuration.WebServicesSection.Current.Diagnostics.SuppressReturningExceptions) {
         return CreateSuppressedException(soapVersion, Res.GetString(Res.WebSuppressedExceptionMessage), innerException);
     }
     else {
         return new SoapException(message, code, actor, role, detail, subCode, innerException);
     }
 }
 private static void WriteFaultCodeValue(XmlWriter writer, XmlQualifiedName code, SoapFaultSubCode subcode) {
     if (code == null) return;
     writer.WriteStartElement(Soap12.Element.FaultCodeValue, Soap12.Namespace);
     if (code.Namespace != null && code.Namespace.Length > 0 && writer.LookupPrefix(code.Namespace) == null)
         writer.WriteAttributeString("xmlns", "q0", null, code.Namespace);
     writer.WriteQualifiedName(code.Name, code.Namespace);
     writer.WriteEndElement(); // </value>
     if (subcode != null) {
         writer.WriteStartElement(Soap12.Element.FaultSubcode, Soap12.Namespace);
         WriteFaultCodeValue(writer, subcode.Code, subcode.SubCode);
         writer.WriteEndElement(); // </subcode>
     }
 }
        protected SoapException(SerializationInfo info, StreamingContext context) : base(info, context) {
            IDictionary list = base.Data;
            code = (XmlQualifiedName)list["code"];
            actor = (string)list["actor"];
            role = (string)list["role"];
            
            // Bug: 323493: XmlNode is not serializable, and I don't think we want to really want to create
            // an XmlDocument just to read a XmlNode from string to get the deserialized instance back.
            // detail = (XmlNode)list["detail"];

            subCode = (SoapFaultSubCode)list["subCode"];
            lang = (string)list["lang"];
        }
示例#36
0
 public SoapFaultSubCode(XmlQualifiedName code, SoapFaultSubCode subcode)
 {
     _code    = code;
     _subcode = subcode;
 }
示例#37
0
 /// <include file='doc\SoapException.uex' path='docs/doc[@for="SoapException.SoapException6"]/*' />
 /// <devdoc>
 ///    <para>[To be supplied.]</para>
 /// </devdoc>
 public SoapException(string message, XmlQualifiedName code, SoapFaultSubCode subCode) : base(message)
 {
     this.code    = code;
     this.subCode = subCode;
 }
示例#38
0
		static Soap12FaultCode CreateFaultCode (SoapFaultSubCode code)
		{
			if (code == null)
				throw new ArgumentNullException ("code");
			Soap12FaultCode ret = new Soap12FaultCode ();
			ret.Value = code.Code;
			if (code.SubCode != null)
				ret.Subcode = CreateFaultCode (code.SubCode);
			return ret;
		}
 internal void ClearSubCode()
 {
     if (this.subCode != null)
     {
         this.subCode = this.subCode.SubCode;
     }
 }
示例#40
0
		public SoapException (string message, XmlQualifiedName code, string actor, string role, XmlNode detail, SoapFaultSubCode subcode, Exception innerException)
			: base (message, innerException)
		{
			this.code = code;
			this.subcode = subcode;
			this.detail = detail;
			this.actor = actor;
			this.role = role;
		}
示例#41
0
        protected SoapException(SerializationInfo info, StreamingContext context) : base(info, context) {
            IDictionary list = base.Data;
            code = (XmlQualifiedName)list["code"];
            actor = (string)list["actor"];
            role = (string)list["role"];
            
            // 



            subCode = (SoapFaultSubCode)list["subCode"];
            lang = (string)list["lang"];
        }
示例#42
0
		protected SoapException (SerializationInfo info, StreamingContext context)
			: base (info, context)
		{
			actor = info.GetString ("actor");
			code = (XmlQualifiedName) info.GetValue ("code", typeof (XmlQualifiedName));
			detail = new XmlDocument ().ReadNode (
				XmlReader.Create (new StringReader (info.GetString ("detailString"))));
			lang = info.GetString ("lang");
			role = info.GetString ("role");
			subcode = (SoapFaultSubCode) info.GetValue ("subcode", typeof (SoapFaultSubCode));
		}
示例#43
0
 public SoapException(string message, XmlQualifiedName code, string actor, string role, string lang, XmlNode detail, SoapFaultSubCode subcode, Exception innerException)
     : this(message, code, actor, role, detail, subcode, innerException)
 {
     this.lang = lang;
 }
示例#44
0
        private SoapException ReadSoapException(XmlReader reader)
        {
            XmlQualifiedName code    = XmlQualifiedName.Empty;
            string           message = (string)null;
            string           actor   = (string)null;
            string           role    = (string)null;
            XmlNode          detail  = (XmlNode)null;
            SoapFaultSubCode subcode = (SoapFaultSubCode)null;
            string           lang    = (string)null;
            bool             flag    = reader.NamespaceURI == "http://www.w3.org/2003/05/soap-envelope";

            if (reader.IsEmptyElement)
            {
                reader.Skip();
            }
            else
            {
                reader.ReadStartElement();
                int num1  = (int)reader.MoveToContent();
                int depth = reader.Depth;
                while (reader.NodeType != XmlNodeType.EndElement && reader.NodeType != XmlNodeType.None)
                {
                    if (reader.NamespaceURI == "http://schemas.xmlsoap.org/soap/envelope/" || reader.NamespaceURI == "http://www.w3.org/2003/05/soap-envelope" || (reader.NamespaceURI == null || reader.NamespaceURI.Length == 0))
                    {
                        if (reader.LocalName == "faultcode" || reader.LocalName == "Code")
                        {
                            code = !flag?this.ReadFaultCode(reader) : this.ReadSoap12FaultCode(reader, out subcode);
                        }
                        else if (reader.LocalName == "faultstring")
                        {
                            lang = reader.GetAttribute("lang", "http://www.w3.org/XML/1998/namespace");
                            reader.MoveToElement();
                            message = reader.ReadElementString();
                        }
                        else if (reader.LocalName == "Reason")
                        {
                            if (reader.IsEmptyElement)
                            {
                                reader.Skip();
                            }
                            else
                            {
                                reader.ReadStartElement();
                                int num2 = (int)reader.MoveToContent();
                                while (reader.NodeType != XmlNodeType.EndElement && reader.NodeType != XmlNodeType.None)
                                {
                                    if (reader.LocalName == "Text" && reader.NamespaceURI == "http://www.w3.org/2003/05/soap-envelope")
                                    {
                                        message = reader.ReadElementString();
                                    }
                                    else
                                    {
                                        reader.Skip();
                                    }
                                    int num3 = (int)reader.MoveToContent();
                                }
                                while (reader.NodeType == XmlNodeType.Whitespace)
                                {
                                    reader.Skip();
                                }
                                if (reader.NodeType == XmlNodeType.None)
                                {
                                    reader.Skip();
                                }
                                else
                                {
                                    reader.ReadEndElement();
                                }
                            }
                        }
                        else if (reader.LocalName == "faultactor" || reader.LocalName == "Node")
                        {
                            actor = reader.ReadElementString();
                        }
                        else if (reader.LocalName == "detail" || reader.LocalName == "Detail")
                        {
                            detail = new XmlDocument().ReadNode(reader);
                        }
                        else if (reader.LocalName == "Role")
                        {
                            role = reader.ReadElementString();
                        }
                        else
                        {
                            reader.Skip();
                        }
                    }
                    else
                    {
                        reader.Skip();
                    }
                    int num4 = (int)reader.MoveToContent();
                }
                do
                {
                    ;
                }while (reader.Read() && depth < reader.Depth);
                if (reader.NodeType == XmlNodeType.EndElement)
                {
                    reader.Read();
                }
            }
            if (detail != null || flag)
            {
                return(new SoapException(message, code, actor, role, lang, detail, subcode, (Exception)null));
            }
            else
            {
                return((SoapException) new SoapHeaderException(message, code, actor, role, lang, subcode, (Exception)null));
            }
        }
示例#45
0
 private static void WriteFaultCodeValue(XmlWriter writer, XmlQualifiedName code, SoapFaultSubCode subcode)
 {
     if (code != null)
     {
         writer.WriteStartElement("Value", "http://www.w3.org/2003/05/soap-envelope");
         if (((code.Namespace != null) && (code.Namespace.Length > 0)) && (writer.LookupPrefix(code.Namespace) == null))
         {
             writer.WriteAttributeString("xmlns", "q0", null, code.Namespace);
         }
         writer.WriteQualifiedName(code.Name, code.Namespace);
         writer.WriteEndElement();
         if (subcode != null)
         {
             writer.WriteStartElement("Subcode", "http://www.w3.org/2003/05/soap-envelope");
             WriteFaultCodeValue(writer, subcode.Code, subcode.SubCode);
             writer.WriteEndElement();
         }
     }
 }