Exemple #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");
 }
Exemple #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   = "";
 }
Exemple #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;
        }
Exemple #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;
        }
Exemple #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;
        }
Exemple #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);
        }
Exemple #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   = "";
        }
Exemple #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));
                }
            }
        }
Exemple #10
0
 public FaultException(FaultReason reason, FaultCode code)
     : base(GetSafeReasonText(reason))
 {
     _code   = EnsureCode(code);
     _reason = EnsureReason(reason);
 }
Exemple #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);
 }
Exemple #12
0
 internal void AddFaultReasonObjectData(SerializationInfo info, string key, FaultReason reason)
 {
     info.AddValue(key, FaultReasonData.GetObjectData(reason));
 }
Exemple #13
0
 internal FaultException(string reason, FaultCode code)
     : base(reason)
 {
     this.code   = FaultException.EnsureCode(code);
     this.reason = FaultException.CreateReason(reason);
 }
Exemple #14
0
 public FaultException()
     : base(SR.SFxFaultReason)
 {
     _code   = DefaultCode;
     _reason = DefaultReason;
 }
Exemple #15
0
 public FaultException()
     : base(SR.SFxFaultReason)
 {
     code   = FaultException.DefaultCode;
     reason = FaultException.DefaultReason;
 }
Exemple #16
0
 static FaultReason EnsureReason(FaultReason reason)
 {
     return(reason ?? DefaultReason);
 }
Exemple #17
0
 static FaultReason EnsureReason(FaultReason reason)
 {
     return((reason != null) ? reason : DefaultReason);
 }
Exemple #18
0
 public FaultException(string reason)
     : base(reason)
 {
     _code   = DefaultCode;
     _reason = CreateReason(reason);
 }
Exemple #19
0
 public FaultException(string reason, FaultCode code)
     : base(reason)
 {
     _code   = EnsureCode(code);
     _reason = CreateReason(reason);
 }
Exemple #20
0
 public FaultException(FaultReason reason)
     : base(GetSafeReasonText(reason))
 {
     _code   = DefaultCode;
     _reason = EnsureReason(reason);
 }