Exemplo n.º 1
0
 protected FaultException(SerializationInfo info, StreamingContext context)
     : base(info, context)
 {
     _code   = ReconstructFaultCode(info, "code");
     _reason = ReconstructFaultReason(info, "reason");
     _fault  = (MessageFault)info.GetValue("messageFault", typeof(MessageFault));
     _action = (string)info.GetString("action");
 }
Exemplo n.º 2
0
 public WSAddressing10ProblemHeaderQNameFault(ActionMismatchAddressingException e)
 {
     _invalidHeaderName = AddressingStrings.Action;
     _code = FaultCode.CreateSenderFaultCode(
         new FaultCode(Addressing10Strings.ActionMismatch, AddressingVersion.WSAddressing10.Namespace));
     _reason = new FaultReason(new FaultReasonText(e.Message, CultureInfo.CurrentCulture.Name));
     _actor  = "";
     _node   = "";
 }
Exemplo n.º 3
0
        public FaultException(MessageFault fault)
            : base(GetSafeReasonText(GetReason(fault)))
        {
            if (fault == null)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("fault");
            }

            _code   = EnsureCode(fault.Code);
            _reason = EnsureReason(fault.Reason);
            _fault  = fault;
        }
Exemplo n.º 4
0
        public FaultException(MessageFault fault, string action)
            : base(FaultException.GetSafeReasonText(GetReason(fault)))
        {
            if (fault == null)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("fault");
            }

            code        = fault.Code;
            reason      = fault.Reason;
            this.fault  = fault;
            this.action = action;
        }
Exemplo n.º 5
0
        public FaultException(MessageFault fault, string action)
            : base(GetSafeReasonText(GetReason(fault)))
        {
            if (fault == null)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull(nameof(fault));
            }

            _code   = fault.Code;
            _reason = fault.Reason;
            _fault  = fault;
            _action = action;
        }
Exemplo n.º 6
0
            internal static FaultReasonData[] GetObjectData(FaultReason reason)
            {
                ReadOnlyCollection <FaultReasonText> translations = reason.Translations;

                FaultReasonData[] array = new FaultReasonData[translations.Count];

                for (int i = 0; i < translations.Count; i++)
                {
                    array[i]         = new FaultReasonData();
                    array[i].xmlLang = translations[i].XmlLang;
                    array[i].text    = translations[i].Text;
                }

                return(array);
            }
        internal Message ProvideFault(MessageVersion messageVersion)
        {
            string       name        = notUnderstoodHeaders[0].Name;
            string       ns          = notUnderstoodHeaders[0].Namespace;
            FaultCode    code        = new FaultCode(MessageStrings.MustUnderstandFault, envelopeVersion.Namespace);
            FaultReason  reason      = new FaultReason(SR.Format(SR.SFxHeaderNotUnderstood, name, ns), CultureInfo.CurrentCulture);
            MessageFault fault       = MessageFault.CreateFault(code, reason);
            string       faultAction = messageVersion.Addressing.DefaultFaultAction;
            Message      message     = CoreWCF.Channels.Message.CreateMessage(messageVersion, fault, faultAction);

            if (envelopeVersion == EnvelopeVersion.Soap12)
            {
                AddNotUnderstoodHeaders(message.Headers);
            }
            return(message);
        }
Exemplo n.º 8
0
        public WSAddressing10ProblemHeaderQNameFault(MessageHeaderException e)
        {
            _invalidHeaderName = e.HeaderName;

            if (e.IsDuplicate)
            {
                _code = FaultCode.CreateSenderFaultCode(
                    new FaultCode(Addressing10Strings.InvalidAddressingHeader,
                                  AddressingVersion.WSAddressing10.Namespace,
                                  new FaultCode(Addressing10Strings.InvalidCardinality,
                                                AddressingVersion.WSAddressing10.Namespace)));
            }
            else
            {
                _code = FaultCode.CreateSenderFaultCode(
                    new FaultCode(Addressing10Strings.MessageAddressingHeaderRequired,
                                  AddressingVersion.WSAddressing10.Namespace));
            }

            _reason = new FaultReason(new FaultReasonText(e.Message, CultureInfo.CurrentCulture.Name));
            _actor  = "";
            _node   = "";
        }
Exemplo n.º 9
0
        internal static string GetSafeReasonText(FaultReason reason)
        {
            if (reason == null)
            {
                return(SR.SFxUnknownFaultNullReason0);
            }

            try
            {
                return(reason.GetMatchingTranslation(System.Globalization.CultureInfo.CurrentCulture).Text);
            }
            catch (ArgumentException)
            {
                if (reason.Translations.Count == 0)
                {
                    return(SR.SFxUnknownFaultZeroReasons0);
                }
                else
                {
                    return(SR.Format(SR.SFxUnknownFaultNoMatchingTranslation1, reason.Translations[0].Text));
                }
            }
        }
Exemplo n.º 10
0
 public FaultException(FaultReason reason, FaultCode code)
     : base(GetSafeReasonText(reason))
 {
     _code   = EnsureCode(code);
     _reason = EnsureReason(reason);
 }
Exemplo n.º 11
0
 // public on full framework
 internal FaultException(FaultReason reason, FaultCode code)
     : base(FaultException.GetSafeReasonText(reason))
 {
     this.code   = FaultException.EnsureCode(code);
     this.reason = FaultException.EnsureReason(reason);
 }
Exemplo n.º 12
0
 internal void AddFaultReasonObjectData(SerializationInfo info, string key, FaultReason reason)
 {
     info.AddValue(key, FaultReasonData.GetObjectData(reason));
 }
Exemplo n.º 13
0
 internal FaultException(string reason, FaultCode code)
     : base(reason)
 {
     this.code   = FaultException.EnsureCode(code);
     this.reason = FaultException.CreateReason(reason);
 }
Exemplo n.º 14
0
 public FaultException()
     : base(SR.SFxFaultReason)
 {
     _code   = DefaultCode;
     _reason = DefaultReason;
 }
Exemplo n.º 15
0
 public FaultException()
     : base(SR.SFxFaultReason)
 {
     code   = FaultException.DefaultCode;
     reason = FaultException.DefaultReason;
 }
Exemplo n.º 16
0
 static FaultReason EnsureReason(FaultReason reason)
 {
     return(reason ?? DefaultReason);
 }
Exemplo n.º 17
0
 static FaultReason EnsureReason(FaultReason reason)
 {
     return((reason != null) ? reason : DefaultReason);
 }
Exemplo n.º 18
0
 public FaultException(string reason)
     : base(reason)
 {
     _code   = DefaultCode;
     _reason = CreateReason(reason);
 }
Exemplo n.º 19
0
 public FaultException(string reason, FaultCode code)
     : base(reason)
 {
     _code   = EnsureCode(code);
     _reason = CreateReason(reason);
 }
Exemplo n.º 20
0
 public FaultException(FaultReason reason)
     : base(GetSafeReasonText(reason))
 {
     _code   = DefaultCode;
     _reason = EnsureReason(reason);
 }