示例#1
0
		public Soap12Fault (SoapException ex) 
		{
			Code = new Soap12FaultCode ();
			Code.Value = ex.Code;
			if (ex.SubCode != null)
				Code.Subcode = CreateFaultCode (ex.SubCode);
			Node = ex.Node;
			Role = ex.Role;
			Reason = new Soap12FaultReason ();
			Soap12FaultReasonText text =
				new Soap12FaultReasonText ();
			text.XmlLang = ex.Lang;
			text.Value = ex.Message;
			Reason.Texts = new Soap12FaultReasonText [] {text};
			if (ex.Detail != null) {
				Detail = new Soap12FaultDetail ();
				if (ex.Detail.NodeType == XmlNodeType.Attribute)
					Detail.Attributes = new XmlAttribute [] {
						(XmlAttribute) ex.Detail};
				else if (ex.Detail.NodeType == XmlNodeType.Element)
					Detail.Children = new XmlElement [] {
						(XmlElement) ex.Detail};
				else
					Detail.Text = ex.Detail.Value;
			}
		}
示例#2
0
        public Soap12Fault(SoapException ex)
        {
            Code       = new Soap12FaultCode();
            Code.Value = ex.Code;
            if (ex.SubCode != null)
            {
                Code.Subcode = CreateFaultCode(ex.SubCode);
            }
            Node   = ex.Node;
            Role   = ex.Role;
            Reason = new Soap12FaultReason();
            Soap12FaultReasonText text =
                new Soap12FaultReasonText();

            text.XmlLang = ex.Lang;
            text.Value   = ex.Message;
            Reason.Texts = new Soap12FaultReasonText [] { text };
            if (ex.Detail != null)
            {
                Detail = new Soap12FaultDetail();
                if (ex.Detail.NodeType == XmlNodeType.Attribute)
                {
                    Detail.Attributes = new XmlAttribute [] {
                        (XmlAttribute)ex.Detail
                    }
                }
                ;
                else if (ex.Detail.NodeType == XmlNodeType.Element)
                {
                    Detail.Children = new XmlElement [] {
                        (XmlElement)ex.Detail
                    }
                }
                ;
                else
                {
                    Detail.Text = ex.Detail.Value;
                }
            }
        }
示例#3
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));
        }