public WSAddressing10ProblemHeaderQNameFault(MessageHeaderException e) { this.invalidHeaderName = e.HeaderName; if (e.IsDuplicate) { this.code = FaultCode.CreateSenderFaultCode(new FaultCode("InvalidAddressingHeader", AddressingVersion.WSAddressing10.Namespace, new FaultCode("InvalidCardinality", AddressingVersion.WSAddressing10.Namespace))); } else { this.code = FaultCode.CreateSenderFaultCode(new FaultCode("MessageAddressingHeaderRequired", AddressingVersion.WSAddressing10.Namespace)); } this.reason = new FaultReason(e.Message, CultureInfo.CurrentCulture); this.actor = ""; this.node = ""; }
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(e.Message, CultureInfo.CurrentCulture); _actor = ""; _node = ""; }
protected override bool OnTryCreateException(Message message, MessageFault fault, out Exception exception) { bool isSenderFault; bool isReceiverFault; FaultCode subCode; exception = null; if ((string.Compare(fault.Code.Namespace, this.version.Envelope.Namespace, StringComparison.Ordinal) == 0) && (string.Compare(fault.Code.Name, "MustUnderstand", StringComparison.Ordinal) == 0)) { exception = new ProtocolException(fault.Reason.GetMatchingTranslation(CultureInfo.CurrentCulture).Text); return true; } if (this.version.Envelope == EnvelopeVersion.Soap11) { isSenderFault = true; isReceiverFault = true; subCode = fault.Code; } else { isSenderFault = fault.Code.IsSenderFault; isReceiverFault = fault.Code.IsReceiverFault; subCode = fault.Code.SubCode; } if (subCode != null) { if (subCode.Namespace == null) { return false; } if (isSenderFault && (string.Compare(subCode.Namespace, this.version.Addressing.Namespace, StringComparison.Ordinal) == 0)) { if (string.Compare(subCode.Name, "ActionNotSupported", StringComparison.Ordinal) == 0) { exception = new ActionNotSupportedException(fault.Reason.GetMatchingTranslation(CultureInfo.CurrentCulture).Text); return true; } if (string.Compare(subCode.Name, "DestinationUnreachable", StringComparison.Ordinal) == 0) { exception = new EndpointNotFoundException(fault.Reason.GetMatchingTranslation(CultureInfo.CurrentCulture).Text); return true; } if (string.Compare(subCode.Name, "InvalidAddressingHeader", StringComparison.Ordinal) == 0) { if (((subCode.SubCode != null) && (string.Compare(subCode.SubCode.Namespace, this.version.Addressing.Namespace, StringComparison.Ordinal) == 0)) && (string.Compare(subCode.SubCode.Name, "InvalidCardinality", StringComparison.Ordinal) == 0)) { exception = new MessageHeaderException(fault.Reason.GetMatchingTranslation(CultureInfo.CurrentCulture).Text, true); return true; } } else if (this.version.Addressing == AddressingVersion.WSAddressing10) { if (string.Compare(subCode.Name, "MessageAddressingHeaderRequired", StringComparison.Ordinal) == 0) { exception = new MessageHeaderException(fault.Reason.GetMatchingTranslation(CultureInfo.CurrentCulture).Text); return true; } if (string.Compare(subCode.Name, "InvalidAddressingHeader", StringComparison.Ordinal) == 0) { exception = new ProtocolException(fault.Reason.GetMatchingTranslation(CultureInfo.CurrentCulture).Text); return true; } } else { if (string.Compare(subCode.Name, "MessageInformationHeaderRequired", StringComparison.Ordinal) == 0) { exception = new ProtocolException(fault.Reason.GetMatchingTranslation(CultureInfo.CurrentCulture).Text); return true; } if (string.Compare(subCode.Name, "InvalidMessageInformationHeader", StringComparison.Ordinal) == 0) { exception = new ProtocolException(fault.Reason.GetMatchingTranslation(CultureInfo.CurrentCulture).Text); return true; } } } if ((isReceiverFault && (string.Compare(subCode.Namespace, this.version.Addressing.Namespace, StringComparison.Ordinal) == 0)) && (string.Compare(subCode.Name, "EndpointUnavailable", StringComparison.Ordinal) == 0)) { exception = new ServerTooBusyException(fault.Reason.GetMatchingTranslation(CultureInfo.CurrentCulture).Text); return true; } } return false; }