public static CreateSequenceInfo ReadMessage(MessageVersion messageVersion, ReliableMessagingVersion reliableMessagingVersion, ISecureConversationSession securitySession, Message message, MessageHeaders headers) { CreateSequenceInfo info; if (message.IsEmpty) { string reason = System.ServiceModel.SR.GetString("NonEmptyWsrmMessageIsEmpty", new object[] { WsrmIndex.GetCreateSequenceActionString(reliableMessagingVersion) }); Message faultReply = WsrmUtilities.CreateCSRefusedProtocolFault(messageVersion, reliableMessagingVersion, reason); throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(WsrmMessageInfo.CreateInternalFaultException(faultReply, reason, new ProtocolException(reason))); } using (XmlDictionaryReader reader = message.GetReaderAtBodyContents()) { info = CreateSequence.Create(messageVersion, reliableMessagingVersion, securitySession, reader); message.ReadFromBodyContentsToEnd(reader); } info.SetMessageId(messageVersion, headers); info.SetReplyTo(messageVersion, headers); if (info.AcksTo.Uri != info.ReplyTo.Uri) { string str2 = System.ServiceModel.SR.GetString("CSRefusedAcksToMustEqualReplyTo"); Message message3 = WsrmUtilities.CreateCSRefusedProtocolFault(messageVersion, reliableMessagingVersion, str2); throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(WsrmMessageInfo.CreateInternalFaultException(message3, str2, new ProtocolException(str2))); } info.to = message.Headers.To; if ((info.to == null) && (messageVersion.Addressing == AddressingVersion.WSAddressing10)) { info.to = messageVersion.Addressing.AnonymousUri; } return info; }
protected override void OnWriteBodyContents(XmlDictionaryWriter writer) { WsrmFeb2005Dictionary dictionary = XD.WsrmFeb2005Dictionary; XmlDictionaryString namespaceUri = WsrmIndex.GetNamespace(this.reliableMessagingVersion); writer.WriteStartElement(dictionary.CreateSequence, namespaceUri); EndpointAddress localAddress = this.binder.LocalAddress; localAddress.WriteTo(this.addressingVersion, writer, dictionary.AcksTo, namespaceUri); if (this.offerIdentifier != null) { writer.WriteStartElement(dictionary.Offer, namespaceUri); writer.WriteStartElement(dictionary.Identifier, namespaceUri); writer.WriteValue(this.offerIdentifier); writer.WriteEndElement(); if (this.reliableMessagingVersion == ReliableMessagingVersion.WSReliableMessaging11) { Wsrm11Dictionary dictionary2 = DXD.Wsrm11Dictionary; localAddress.WriteTo(this.addressingVersion, writer, dictionary2.Endpoint, namespaceUri); writer.WriteStartElement(dictionary2.IncompleteSequenceBehavior, namespaceUri); writer.WriteValue(this.ordered ? dictionary2.DiscardFollowingFirstGap : dictionary2.NoDiscard); writer.WriteEndElement(); } writer.WriteEndElement(); } ISecureConversationSession innerSession = this.binder.GetInnerSession() as ISecureConversationSession; if (innerSession != null) { innerSession.WriteSessionTokenIdentifier(writer); } writer.WriteEndElement(); }
protected override void OnWriteBodyContents(XmlDictionaryWriter writer) { WsrmFeb2005Dictionary wsrmFeb2005Dictionary = XD.WsrmFeb2005Dictionary; XmlDictionaryString wsrmNs = WsrmIndex.GetNamespace(_reliableMessagingVersion); writer.WriteStartElement(wsrmFeb2005Dictionary.CreateSequence, wsrmNs); EndpointAddress localAddress = _binder.LocalAddress; localAddress.WriteTo(_addressingVersion, writer, wsrmFeb2005Dictionary.AcksTo, wsrmNs); if (_offerIdentifier != null) { writer.WriteStartElement(wsrmFeb2005Dictionary.Offer, wsrmNs); writer.WriteStartElement(wsrmFeb2005Dictionary.Identifier, wsrmNs); writer.WriteValue(_offerIdentifier); writer.WriteEndElement(); if (_reliableMessagingVersion == ReliableMessagingVersion.WSReliableMessaging11) { Wsrm11Dictionary wsrm11Dictionary = DXD.Wsrm11Dictionary; localAddress.WriteTo(_addressingVersion, writer, wsrm11Dictionary.Endpoint, wsrmNs); writer.WriteStartElement(wsrm11Dictionary.IncompleteSequenceBehavior, wsrmNs); writer.WriteValue( _ordered ? wsrm11Dictionary.DiscardFollowingFirstGap : wsrm11Dictionary.NoDiscard); writer.WriteEndElement(); } writer.WriteEndElement(); } ISecureConversationSession securitySession = _binder.GetInnerSession() as ISecureConversationSession; if (securitySession != null) { securitySession.WriteSessionTokenIdentifier(writer); } writer.WriteEndElement(); }
public static void ValidateCreateSequenceHeaders(MessageVersion messageVersion, ISecureConversationSession securitySession, WsrmMessageInfo info) { string reason = null; if (info.UsesSequenceSSLInfo != null) { reason = System.ServiceModel.SR.GetString("CSRefusedSSLNotSupported"); } else if ((info.UsesSequenceSTRInfo != null) && (securitySession == null)) { reason = System.ServiceModel.SR.GetString("CSRefusedSTRNoWSSecurity"); } else if ((info.UsesSequenceSTRInfo == null) && (securitySession != null)) { reason = System.ServiceModel.SR.GetString("CSRefusedNoSTRWSSecurity"); } if (reason != null) { Message faultReply = WsrmUtilities.CreateCSRefusedProtocolFault(messageVersion, ReliableMessagingVersion.WSReliableMessaging11, reason); throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(WsrmMessageInfo.CreateInternalFaultException(faultReply, reason, new ProtocolException(reason))); } }
public static CreateSequenceInfo Create(MessageVersion messageVersion, ReliableMessagingVersion reliableMessagingVersion, ISecureConversationSession securitySession, XmlDictionaryReader reader) { if (reader == null) { Fx.Assert("Argument reader cannot be null."); } try { CreateSequenceInfo info = new CreateSequenceInfo(); WsrmFeb2005Dictionary wsrmFeb2005Dictionary = XD.WsrmFeb2005Dictionary; XmlDictionaryString wsrmNs = WsrmIndex.GetNamespace(reliableMessagingVersion); reader.ReadStartElement(wsrmFeb2005Dictionary.CreateSequence, wsrmNs); info.AcksTo = EndpointAddress.ReadFrom(messageVersion.Addressing, reader, wsrmFeb2005Dictionary.AcksTo, wsrmNs); if (reader.IsStartElement(wsrmFeb2005Dictionary.Expires, wsrmNs)) { info.Expires = reader.ReadElementContentAsTimeSpan(); } if (reader.IsStartElement(wsrmFeb2005Dictionary.Offer, wsrmNs)) { reader.ReadStartElement(); reader.ReadStartElement(wsrmFeb2005Dictionary.Identifier, wsrmNs); info.OfferIdentifier = reader.ReadContentAsUniqueId(); reader.ReadEndElement(); bool wsrm11 = reliableMessagingVersion == ReliableMessagingVersion.WSReliableMessaging11; Wsrm11Dictionary wsrm11Dictionary = wsrm11 ? DXD.Wsrm11Dictionary : null; if (wsrm11) { EndpointAddress endpoint = EndpointAddress.ReadFrom(messageVersion.Addressing, reader, wsrm11Dictionary.Endpoint, wsrmNs); if (endpoint.Uri != info.AcksTo.Uri) { string reason = SR.GetString(SR.CSRefusedAcksToMustEqualEndpoint); Message faultReply = WsrmUtilities.CreateCSRefusedProtocolFault(messageVersion, reliableMessagingVersion, reason); throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(WsrmMessageInfo.CreateInternalFaultException(faultReply, reason, new ProtocolException(reason))); } } if (reader.IsStartElement(wsrmFeb2005Dictionary.Expires, wsrmNs)) { info.OfferExpires = reader.ReadElementContentAsTimeSpan(); } if (wsrm11) { if (reader.IsStartElement(wsrm11Dictionary.IncompleteSequenceBehavior, wsrmNs)) { string incompleteSequenceBehavior = reader.ReadElementContentAsString(); if ((incompleteSequenceBehavior != Wsrm11Strings.DiscardEntireSequence) && (incompleteSequenceBehavior != Wsrm11Strings.DiscardFollowingFirstGap) && (incompleteSequenceBehavior != Wsrm11Strings.NoDiscard)) { string reason = SR.GetString(SR.CSRefusedInvalidIncompleteSequenceBehavior); Message faultReply = WsrmUtilities.CreateCSRefusedProtocolFault(messageVersion, reliableMessagingVersion, reason); throw DiagnosticUtility.ExceptionUtility.ThrowHelperError( WsrmMessageInfo.CreateInternalFaultException(faultReply, reason, new ProtocolException(reason))); } // Otherwise ignore the value. } } while (reader.IsStartElement()) { reader.Skip(); } reader.ReadEndElement(); } // Check for security only if we expect a soap security session. if (securitySession != null) { bool hasValidToken = false; // Since the security element is amongst the extensible elements (i.e. there is no // gaurantee of ordering or placement), a loop is required to attempt to parse the // security element. while (reader.IsStartElement()) { if (securitySession.TryReadSessionTokenIdentifier(reader)) { hasValidToken = true; break; } reader.Skip(); } if (!hasValidToken) { string reason = SR.GetString(SR.CSRefusedRequiredSecurityElementMissing); Message faultReply = WsrmUtilities.CreateCSRefusedProtocolFault(messageVersion, reliableMessagingVersion, reason); throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(WsrmMessageInfo.CreateInternalFaultException(faultReply, reason, new ProtocolException(reason))); } } while (reader.IsStartElement()) { reader.Skip(); } reader.ReadEndElement(); if (reader.IsStartElement()) { string reason = SR.GetString(SR.CSRefusedUnexpectedElementAtEndOfCSMessage); Message faultReply = WsrmUtilities.CreateCSRefusedProtocolFault(messageVersion, reliableMessagingVersion, reason); throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(WsrmMessageInfo.CreateInternalFaultException(faultReply, reason, new ProtocolException(reason))); } return(info); } catch (XmlException e) { string reason = SR.GetString(SR.CouldNotParseWithAction, WsrmIndex.GetCreateSequenceActionString(reliableMessagingVersion)); Message faultReply = WsrmUtilities.CreateCSRefusedProtocolFault(messageVersion, reliableMessagingVersion, reason); throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(WsrmMessageInfo.CreateInternalFaultException(faultReply, reason, new ProtocolException(reason, e))); } }
public static CreateSequenceInfo Create(MessageVersion messageVersion, ReliableMessagingVersion reliableMessagingVersion, ISecureConversationSession securitySession, XmlDictionaryReader reader) { CreateSequenceInfo info2; try { CreateSequenceInfo info = new CreateSequenceInfo(); WsrmFeb2005Dictionary dictionary = XD.WsrmFeb2005Dictionary; XmlDictionaryString namespaceUri = WsrmIndex.GetNamespace(reliableMessagingVersion); reader.ReadStartElement(dictionary.CreateSequence, namespaceUri); info.AcksTo = EndpointAddress.ReadFrom(messageVersion.Addressing, reader, dictionary.AcksTo, namespaceUri); if (reader.IsStartElement(dictionary.Expires, namespaceUri)) { info.Expires = new TimeSpan?(reader.ReadElementContentAsTimeSpan()); } if (!reader.IsStartElement(dictionary.Offer, namespaceUri)) { goto Label_01B7; } reader.ReadStartElement(); reader.ReadStartElement(dictionary.Identifier, namespaceUri); info.OfferIdentifier = reader.ReadContentAsUniqueId(); reader.ReadEndElement(); bool flag = reliableMessagingVersion == ReliableMessagingVersion.WSReliableMessaging11; Wsrm11Dictionary dictionary2 = flag ? DXD.Wsrm11Dictionary : null; if (flag && (EndpointAddress.ReadFrom(messageVersion.Addressing, reader, dictionary2.Endpoint, namespaceUri).Uri != info.AcksTo.Uri)) { string str2 = System.ServiceModel.SR.GetString("CSRefusedAcksToMustEqualEndpoint"); Message message = WsrmUtilities.CreateCSRefusedProtocolFault(messageVersion, reliableMessagingVersion, str2); throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(WsrmMessageInfo.CreateInternalFaultException(message, str2, new ProtocolException(str2))); } if (reader.IsStartElement(dictionary.Expires, namespaceUri)) { info.OfferExpires = new TimeSpan?(reader.ReadElementContentAsTimeSpan()); } if (!flag || !reader.IsStartElement(dictionary2.IncompleteSequenceBehavior, namespaceUri)) { goto Label_01A9; } string str3 = reader.ReadElementContentAsString(); if ((!(str3 != "DiscardEntireSequence") || !(str3 != "DiscardFollowingFirstGap")) || !(str3 != "NoDiscard")) { goto Label_01A9; } string reason = System.ServiceModel.SR.GetString("CSRefusedInvalidIncompleteSequenceBehavior"); Message faultReply = WsrmUtilities.CreateCSRefusedProtocolFault(messageVersion, reliableMessagingVersion, reason); throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(WsrmMessageInfo.CreateInternalFaultException(faultReply, reason, new ProtocolException(reason))); Label_01A3: reader.Skip(); Label_01A9: if (reader.IsStartElement()) { goto Label_01A3; } reader.ReadEndElement(); Label_01B7: if (securitySession == null) { goto Label_0217; } bool flag2 = false; while (reader.IsStartElement()) { if (securitySession.TryReadSessionTokenIdentifier(reader)) { flag2 = true; break; } reader.Skip(); } if (flag2) { goto Label_0217; } string str5 = System.ServiceModel.SR.GetString("CSRefusedRequiredSecurityElementMissing"); Message message3 = WsrmUtilities.CreateCSRefusedProtocolFault(messageVersion, reliableMessagingVersion, str5); throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(WsrmMessageInfo.CreateInternalFaultException(message3, str5, new ProtocolException(str5))); Label_0211: reader.Skip(); Label_0217: if (reader.IsStartElement()) { goto Label_0211; } reader.ReadEndElement(); if (reader.IsStartElement()) { string str6 = System.ServiceModel.SR.GetString("CSRefusedUnexpectedElementAtEndOfCSMessage"); Message message4 = WsrmUtilities.CreateCSRefusedProtocolFault(messageVersion, reliableMessagingVersion, str6); throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(WsrmMessageInfo.CreateInternalFaultException(message4, str6, new ProtocolException(str6))); } info2 = info; } catch (XmlException exception) { string str7 = System.ServiceModel.SR.GetString("CouldNotParseWithAction", new object[] { WsrmIndex.GetCreateSequenceActionString(reliableMessagingVersion) }); Message message5 = WsrmUtilities.CreateCSRefusedProtocolFault(messageVersion, reliableMessagingVersion, str7); throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(WsrmMessageInfo.CreateInternalFaultException(message5, str7, new ProtocolException(str7, exception))); } return info2; }
public static CreateSequenceInfo Create(MessageVersion messageVersion, ReliableMessagingVersion reliableMessagingVersion, ISecureConversationSession securitySession, XmlDictionaryReader reader) { if (reader == null) { Fx.Assert("Argument reader cannot be null."); } try { CreateSequenceInfo info = new CreateSequenceInfo(); WsrmFeb2005Dictionary wsrmFeb2005Dictionary = XD.WsrmFeb2005Dictionary; XmlDictionaryString wsrmNs = WsrmIndex.GetNamespace(reliableMessagingVersion); reader.ReadStartElement(wsrmFeb2005Dictionary.CreateSequence, wsrmNs); info.AcksTo = EndpointAddress.ReadFrom(messageVersion.Addressing, reader, wsrmFeb2005Dictionary.AcksTo, wsrmNs); if (reader.IsStartElement(wsrmFeb2005Dictionary.Expires, wsrmNs)) { info.Expires = reader.ReadElementContentAsTimeSpan(); } if (reader.IsStartElement(wsrmFeb2005Dictionary.Offer, wsrmNs)) { reader.ReadStartElement(); reader.ReadStartElement(wsrmFeb2005Dictionary.Identifier, wsrmNs); info.OfferIdentifier = reader.ReadContentAsUniqueId(); reader.ReadEndElement(); bool wsrm11 = reliableMessagingVersion == ReliableMessagingVersion.WSReliableMessaging11; Wsrm11Dictionary wsrm11Dictionary = wsrm11 ? DXD.Wsrm11Dictionary : null; if (wsrm11) { EndpointAddress endpoint = EndpointAddress.ReadFrom(messageVersion.Addressing, reader, wsrm11Dictionary.Endpoint, wsrmNs); if (endpoint.Uri != info.AcksTo.Uri) { string reason = SR.GetString(SR.CSRefusedAcksToMustEqualEndpoint); Message faultReply = WsrmUtilities.CreateCSRefusedProtocolFault(messageVersion, reliableMessagingVersion, reason); throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(WsrmMessageInfo.CreateInternalFaultException(faultReply, reason, new ProtocolException(reason))); } } if (reader.IsStartElement(wsrmFeb2005Dictionary.Expires, wsrmNs)) { info.OfferExpires = reader.ReadElementContentAsTimeSpan(); } if (wsrm11) { if (reader.IsStartElement(wsrm11Dictionary.IncompleteSequenceBehavior, wsrmNs)) { string incompleteSequenceBehavior = reader.ReadElementContentAsString(); if ((incompleteSequenceBehavior != Wsrm11Strings.DiscardEntireSequence) && (incompleteSequenceBehavior != Wsrm11Strings.DiscardFollowingFirstGap) && (incompleteSequenceBehavior != Wsrm11Strings.NoDiscard)) { string reason = SR.GetString(SR.CSRefusedInvalidIncompleteSequenceBehavior); Message faultReply = WsrmUtilities.CreateCSRefusedProtocolFault(messageVersion, reliableMessagingVersion, reason); throw DiagnosticUtility.ExceptionUtility.ThrowHelperError( WsrmMessageInfo.CreateInternalFaultException(faultReply, reason, new ProtocolException(reason))); } // Otherwise ignore the value. } } while (reader.IsStartElement()) { reader.Skip(); } reader.ReadEndElement(); } // Check for security only if we expect a soap security session. if (securitySession != null) { bool hasValidToken = false; // Since the security element is amongst the extensible elements (i.e. there is no // gaurantee of ordering or placement), a loop is required to attempt to parse the // security element. while (reader.IsStartElement()) { if (securitySession.TryReadSessionTokenIdentifier(reader)) { hasValidToken = true; break; } reader.Skip(); } if (!hasValidToken) { string reason = SR.GetString(SR.CSRefusedRequiredSecurityElementMissing); Message faultReply = WsrmUtilities.CreateCSRefusedProtocolFault(messageVersion, reliableMessagingVersion, reason); throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(WsrmMessageInfo.CreateInternalFaultException(faultReply, reason, new ProtocolException(reason))); } } while (reader.IsStartElement()) { reader.Skip(); } reader.ReadEndElement(); if (reader.IsStartElement()) { string reason = SR.GetString(SR.CSRefusedUnexpectedElementAtEndOfCSMessage); Message faultReply = WsrmUtilities.CreateCSRefusedProtocolFault(messageVersion, reliableMessagingVersion, reason); throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(WsrmMessageInfo.CreateInternalFaultException(faultReply, reason, new ProtocolException(reason))); } return info; } catch (XmlException e) { string reason = SR.GetString(SR.CouldNotParseWithAction, WsrmIndex.GetCreateSequenceActionString(reliableMessagingVersion)); Message faultReply = WsrmUtilities.CreateCSRefusedProtocolFault(messageVersion, reliableMessagingVersion, reason); throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(WsrmMessageInfo.CreateInternalFaultException(faultReply, reason, new ProtocolException(reason, e))); } }
public static CreateSequenceInfo Create(MessageVersion messageVersion, ReliableMessagingVersion reliableMessagingVersion, ISecureConversationSession securitySession, XmlDictionaryReader reader) { CreateSequenceInfo info2; try { CreateSequenceInfo info = new CreateSequenceInfo(); WsrmFeb2005Dictionary dictionary = XD.WsrmFeb2005Dictionary; XmlDictionaryString namespaceUri = WsrmIndex.GetNamespace(reliableMessagingVersion); reader.ReadStartElement(dictionary.CreateSequence, namespaceUri); info.AcksTo = EndpointAddress.ReadFrom(messageVersion.Addressing, reader, dictionary.AcksTo, namespaceUri); if (reader.IsStartElement(dictionary.Expires, namespaceUri)) { info.Expires = new TimeSpan?(reader.ReadElementContentAsTimeSpan()); } if (!reader.IsStartElement(dictionary.Offer, namespaceUri)) { goto Label_01B7; } reader.ReadStartElement(); reader.ReadStartElement(dictionary.Identifier, namespaceUri); info.OfferIdentifier = reader.ReadContentAsUniqueId(); reader.ReadEndElement(); bool flag = reliableMessagingVersion == ReliableMessagingVersion.WSReliableMessaging11; Wsrm11Dictionary dictionary2 = flag ? DXD.Wsrm11Dictionary : null; if (flag && (EndpointAddress.ReadFrom(messageVersion.Addressing, reader, dictionary2.Endpoint, namespaceUri).Uri != info.AcksTo.Uri)) { string str2 = System.ServiceModel.SR.GetString("CSRefusedAcksToMustEqualEndpoint"); Message message = WsrmUtilities.CreateCSRefusedProtocolFault(messageVersion, reliableMessagingVersion, str2); throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(WsrmMessageInfo.CreateInternalFaultException(message, str2, new ProtocolException(str2))); } if (reader.IsStartElement(dictionary.Expires, namespaceUri)) { info.OfferExpires = new TimeSpan?(reader.ReadElementContentAsTimeSpan()); } if (!flag || !reader.IsStartElement(dictionary2.IncompleteSequenceBehavior, namespaceUri)) { goto Label_01A9; } string str3 = reader.ReadElementContentAsString(); if ((!(str3 != "DiscardEntireSequence") || !(str3 != "DiscardFollowingFirstGap")) || !(str3 != "NoDiscard")) { goto Label_01A9; } string reason = System.ServiceModel.SR.GetString("CSRefusedInvalidIncompleteSequenceBehavior"); Message faultReply = WsrmUtilities.CreateCSRefusedProtocolFault(messageVersion, reliableMessagingVersion, reason); throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(WsrmMessageInfo.CreateInternalFaultException(faultReply, reason, new ProtocolException(reason))); Label_01A3: reader.Skip(); Label_01A9: if (reader.IsStartElement()) { goto Label_01A3; } reader.ReadEndElement(); Label_01B7: if (securitySession == null) { goto Label_0217; } bool flag2 = false; while (reader.IsStartElement()) { if (securitySession.TryReadSessionTokenIdentifier(reader)) { flag2 = true; break; } reader.Skip(); } if (flag2) { goto Label_0217; } string str5 = System.ServiceModel.SR.GetString("CSRefusedRequiredSecurityElementMissing"); Message message3 = WsrmUtilities.CreateCSRefusedProtocolFault(messageVersion, reliableMessagingVersion, str5); throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(WsrmMessageInfo.CreateInternalFaultException(message3, str5, new ProtocolException(str5))); Label_0211: reader.Skip(); Label_0217: if (reader.IsStartElement()) { goto Label_0211; } reader.ReadEndElement(); if (reader.IsStartElement()) { string str6 = System.ServiceModel.SR.GetString("CSRefusedUnexpectedElementAtEndOfCSMessage"); Message message4 = WsrmUtilities.CreateCSRefusedProtocolFault(messageVersion, reliableMessagingVersion, str6); throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(WsrmMessageInfo.CreateInternalFaultException(message4, str6, new ProtocolException(str6))); } info2 = info; } catch (XmlException exception) { string str7 = System.ServiceModel.SR.GetString("CouldNotParseWithAction", new object[] { WsrmIndex.GetCreateSequenceActionString(reliableMessagingVersion) }); Message message5 = WsrmUtilities.CreateCSRefusedProtocolFault(messageVersion, reliableMessagingVersion, str7); throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(WsrmMessageInfo.CreateInternalFaultException(message5, str7, new ProtocolException(str7, exception))); } return(info2); }
public static CreateSequenceInfo ReadMessage(MessageVersion messageVersion, ReliableMessagingVersion reliableMessagingVersion, ISecureConversationSession securitySession, Message message, MessageHeaders headers) { CreateSequenceInfo info; if (message.IsEmpty) { string reason = System.ServiceModel.SR.GetString("NonEmptyWsrmMessageIsEmpty", new object[] { WsrmIndex.GetCreateSequenceActionString(reliableMessagingVersion) }); Message faultReply = WsrmUtilities.CreateCSRefusedProtocolFault(messageVersion, reliableMessagingVersion, reason); throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(WsrmMessageInfo.CreateInternalFaultException(faultReply, reason, new ProtocolException(reason))); } using (XmlDictionaryReader reader = message.GetReaderAtBodyContents()) { info = CreateSequence.Create(messageVersion, reliableMessagingVersion, securitySession, reader); message.ReadFromBodyContentsToEnd(reader); } info.SetMessageId(messageVersion, headers); info.SetReplyTo(messageVersion, headers); if (info.AcksTo.Uri != info.ReplyTo.Uri) { string str2 = System.ServiceModel.SR.GetString("CSRefusedAcksToMustEqualReplyTo"); Message message3 = WsrmUtilities.CreateCSRefusedProtocolFault(messageVersion, reliableMessagingVersion, str2); throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(WsrmMessageInfo.CreateInternalFaultException(message3, str2, new ProtocolException(str2))); } info.to = message.Headers.To; if ((info.to == null) && (messageVersion.Addressing == AddressingVersion.WSAddressing10)) { info.to = messageVersion.Addressing.AnonymousUri; } return(info); }