示例#1
0
        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 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);
        }
示例#3
0
        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 WsrmMessageInfo Get(MessageVersion messageVersion, ReliableMessagingVersion reliableMessagingVersion, IChannel channel, ISession session, System.ServiceModel.Channels.Message message, bool csrOnly)
        {
            WsrmMessageInfo info = new WsrmMessageInfo {
                message = message
            };
            bool isFault = true;

            try
            {
                isFault = message.IsFault;
                MessageHeaders headers = message.Headers;
                string         action  = headers.Action;
                info.action = action;
                bool flag2 = false;
                bool flag3 = reliableMessagingVersion == ReliableMessagingVersion.WSReliableMessagingFebruary2005;
                bool flag4 = reliableMessagingVersion == ReliableMessagingVersion.WSReliableMessaging11;
                bool flag5 = false;
                if (action == WsrmIndex.GetCreateSequenceResponseActionString(reliableMessagingVersion))
                {
                    info.createSequenceResponseInfo = System.ServiceModel.Channels.CreateSequenceResponseInfo.ReadMessage(messageVersion, reliableMessagingVersion, message, headers);
                    ValidateMustUnderstand(messageVersion, message);
                    return(info);
                }
                if (csrOnly)
                {
                    return(info);
                }
                if (action == WsrmIndex.GetTerminateSequenceActionString(reliableMessagingVersion))
                {
                    info.terminateSequenceInfo = System.ServiceModel.Channels.TerminateSequenceInfo.ReadMessage(messageVersion, reliableMessagingVersion, message, headers);
                    flag2 = true;
                }
                else if (action == WsrmIndex.GetCreateSequenceActionString(reliableMessagingVersion))
                {
                    info.createSequenceInfo = System.ServiceModel.Channels.CreateSequenceInfo.ReadMessage(messageVersion, reliableMessagingVersion, session as ISecureConversationSession, message, headers);
                    if (flag3)
                    {
                        ValidateMustUnderstand(messageVersion, message);
                        return(info);
                    }
                    flag5 = true;
                }
                else if (flag4)
                {
                    if (action == "http://docs.oasis-open.org/ws-rx/wsrm/200702/CloseSequence")
                    {
                        info.closeSequenceInfo = System.ServiceModel.Channels.CloseSequenceInfo.ReadMessage(messageVersion, message, headers);
                        flag2 = true;
                    }
                    else if (action == "http://docs.oasis-open.org/ws-rx/wsrm/200702/CloseSequenceResponse")
                    {
                        info.closeSequenceResponseInfo = System.ServiceModel.Channels.CloseSequenceResponseInfo.ReadMessage(messageVersion, message, headers);
                        flag2 = true;
                    }
                    else if (action == WsrmIndex.GetTerminateSequenceResponseActionString(reliableMessagingVersion))
                    {
                        info.terminateSequenceResponseInfo = System.ServiceModel.Channels.TerminateSequenceResponseInfo.ReadMessage(messageVersion, message, headers);
                        flag2 = true;
                    }
                }
                string namespaceString = WsrmIndex.GetNamespaceString(reliableMessagingVersion);
                bool   flag6           = messageVersion.Envelope == EnvelopeVersion.Soap11;
                bool   flag7           = false;
                int    num             = -1;
                int    headerIndex     = -1;
                int    num3            = -1;
                int    num4            = -1;
                int    num5            = -1;
                int    num6            = -1;
                int    index           = -1;
                int    num8            = -1;
                int    num9            = -1;
                for (int i = 0; i < headers.Count; i++)
                {
                    MessageHeaderInfo info2 = headers[i];
                    if (messageVersion.Envelope.IsUltimateDestinationActor(info2.Actor) && (info2.Namespace == namespaceString))
                    {
                        bool flag8 = true;
                        if (flag5)
                        {
                            if (flag4 && (info2.Name == "UsesSequenceSSL"))
                            {
                                if (num8 != -1)
                                {
                                    num = i;
                                    break;
                                }
                                num8 = i;
                            }
                            else if (flag4 && (info2.Name == "UsesSequenceSTR"))
                            {
                                if (num9 != -1)
                                {
                                    num = i;
                                    break;
                                }
                                num9 = i;
                            }
                            else
                            {
                                flag8 = false;
                            }
                        }
                        else if (info2.Name == "Sequence")
                        {
                            if (headerIndex != -1)
                            {
                                num = i;
                                break;
                            }
                            headerIndex = i;
                        }
                        else if (info2.Name == "SequenceAcknowledgement")
                        {
                            if (num3 != -1)
                            {
                                num = i;
                                break;
                            }
                            num3 = i;
                        }
                        else if (info2.Name == "AckRequested")
                        {
                            if (num4 != -1)
                            {
                                num = i;
                                break;
                            }
                            num4 = i;
                        }
                        else if (flag6 && (info2.Name == "SequenceFault"))
                        {
                            if (index != -1)
                            {
                                num = i;
                                break;
                            }
                            index = i;
                        }
                        else
                        {
                            flag8 = false;
                        }
                        if (flag8)
                        {
                            if (i > num5)
                            {
                                num5 = i;
                            }
                            if (num6 == -1)
                            {
                                num6 = i;
                            }
                        }
                    }
                }
                if (num != -1)
                {
                    Collection <MessageHeaderInfo> notUnderstoodHeaders = new Collection <MessageHeaderInfo> {
                        headers[num]
                    };
                    throw System.ServiceModel.DiagnosticUtility.ExceptionUtility.ThrowHelperError(new MustUnderstandSoapException(notUnderstoodHeaders, messageVersion.Envelope));
                }
                if (num5 > -1)
                {
                    BufferedMessage message2 = message as BufferedMessage;
                    if ((message2 != null) && message2.Headers.ContainsOnlyBufferedMessageHeaders)
                    {
                        flag7 = true;
                        using (XmlDictionaryReader reader = headers.GetReaderAtHeader(num6))
                        {
                            for (int j = num6; j <= num5; j++)
                            {
                                MessageHeaderInfo header = headers[j];
                                if (flag5)
                                {
                                    if (flag4 && (j == num8))
                                    {
                                        info.usesSequenceSSLInfo = WsrmUsesSequenceSSLInfo.ReadHeader(reader, header);
                                        headers.UnderstoodHeaders.Add(header);
                                    }
                                    else if (flag4 && (j == num9))
                                    {
                                        info.usesSequenceSTRInfo = WsrmUsesSequenceSTRInfo.ReadHeader(reader, header);
                                        headers.UnderstoodHeaders.Add(header);
                                    }
                                    else
                                    {
                                        reader.Skip();
                                    }
                                }
                                else if (j == headerIndex)
                                {
                                    info.sequencedMessageInfo = WsrmSequencedMessageInfo.ReadHeader(reliableMessagingVersion, reader, header);
                                    headers.UnderstoodHeaders.Add(header);
                                }
                                else if (j == num3)
                                {
                                    info.acknowledgementInfo = WsrmAcknowledgmentInfo.ReadHeader(reliableMessagingVersion, reader, header);
                                    headers.UnderstoodHeaders.Add(header);
                                }
                                else if (j == num4)
                                {
                                    info.ackRequestedInfo = WsrmAckRequestedInfo.ReadHeader(reliableMessagingVersion, reader, header);
                                    headers.UnderstoodHeaders.Add(header);
                                }
                                else
                                {
                                    reader.Skip();
                                }
                            }
                        }
                    }
                }
                if ((num5 > -1) && !flag7)
                {
                    flag7 = true;
                    if (flag5)
                    {
                        if (num8 != -1)
                        {
                            using (XmlDictionaryReader reader2 = headers.GetReaderAtHeader(num8))
                            {
                                MessageHeaderInfo info4 = headers[num8];
                                info.usesSequenceSSLInfo = WsrmUsesSequenceSSLInfo.ReadHeader(reader2, info4);
                                headers.UnderstoodHeaders.Add(info4);
                            }
                        }
                        if (num9 == -1)
                        {
                            goto Label_05CB;
                        }
                        using (XmlDictionaryReader reader3 = headers.GetReaderAtHeader(num9))
                        {
                            MessageHeaderInfo info5 = headers[num9];
                            info.usesSequenceSTRInfo = WsrmUsesSequenceSTRInfo.ReadHeader(reader3, info5);
                            headers.UnderstoodHeaders.Add(info5);
                            goto Label_05CB;
                        }
                    }
                    if (headerIndex != -1)
                    {
                        using (XmlDictionaryReader reader4 = headers.GetReaderAtHeader(headerIndex))
                        {
                            MessageHeaderInfo info6 = headers[headerIndex];
                            info.sequencedMessageInfo = WsrmSequencedMessageInfo.ReadHeader(reliableMessagingVersion, reader4, info6);
                            headers.UnderstoodHeaders.Add(info6);
                        }
                    }
                    if (num3 != -1)
                    {
                        using (XmlDictionaryReader reader5 = headers.GetReaderAtHeader(num3))
                        {
                            MessageHeaderInfo info7 = headers[num3];
                            info.acknowledgementInfo = WsrmAcknowledgmentInfo.ReadHeader(reliableMessagingVersion, reader5, info7);
                            headers.UnderstoodHeaders.Add(info7);
                        }
                    }
                    if (num4 != -1)
                    {
                        using (XmlDictionaryReader reader6 = headers.GetReaderAtHeader(num4))
                        {
                            MessageHeaderInfo info8 = headers[num4];
                            info.ackRequestedInfo = WsrmAckRequestedInfo.ReadHeader(reliableMessagingVersion, reader6, info8);
                            headers.UnderstoodHeaders.Add(info8);
                        }
                    }
                }
Label_05CB:
                if (flag5)
                {
                    System.ServiceModel.Channels.CreateSequenceInfo.ValidateCreateSequenceHeaders(messageVersion, session as ISecureConversationSession, info);
                    ValidateMustUnderstand(messageVersion, message);
                    return(info);
                }
                if ((info.sequencedMessageInfo == null) && (info.action == null))
                {
                    if (flag3)
                    {
                        throw System.ServiceModel.DiagnosticUtility.ExceptionUtility.ThrowHelperError(new MessageHeaderException(System.ServiceModel.SR.GetString("NoActionNoSequenceHeaderReason"), messageVersion.Addressing.Namespace, "Action", false));
                    }
                    throw System.ServiceModel.DiagnosticUtility.ExceptionUtility.ThrowHelperError(CreateWsrmRequiredException(messageVersion));
                }
                if ((info.sequencedMessageInfo == null) && message.IsFault)
                {
                    System.ServiceModel.Channels.WsrmHeaderFault fault;
                    info.faultInfo = System.ServiceModel.Channels.MessageFault.CreateFault(message, 0x10000);
                    if (flag6)
                    {
                        if (System.ServiceModel.Channels.WsrmHeaderFault.TryCreateFault11(reliableMessagingVersion, message, info.faultInfo, index, out fault))
                        {
                            info.faultInfo      = fault;
                            info.faultException = WsrmFault.CreateException(fault);
                        }
                    }
                    else if (System.ServiceModel.Channels.WsrmHeaderFault.TryCreateFault12(reliableMessagingVersion, message, info.faultInfo, out fault))
                    {
                        info.faultInfo      = fault;
                        info.faultException = WsrmFault.CreateException(fault);
                    }
                    if (fault == null)
                    {
                        FaultConverter property = channel.GetProperty <FaultConverter>();
                        if (property == null)
                        {
                            property = FaultConverter.GetDefaultFaultConverter(messageVersion);
                        }
                        if (!property.TryCreateException(message, info.faultInfo, out info.faultException))
                        {
                            info.faultException = new ProtocolException(System.ServiceModel.SR.GetString("UnrecognizedFaultReceived", new object[] { info.faultInfo.Code.Namespace, info.faultInfo.Code.Name, System.ServiceModel.FaultException.GetSafeReasonText(info.faultInfo) }));
                        }
                    }
                    flag2 = true;
                }
                if (!flag7 && !flag2)
                {
                    if (flag3)
                    {
                        throw System.ServiceModel.DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ActionNotSupportedException(System.ServiceModel.SR.GetString("NonWsrmFeb2005ActionNotSupported", new object[] { action })));
                    }
                    throw System.ServiceModel.DiagnosticUtility.ExceptionUtility.ThrowHelperError(CreateWsrmRequiredException(messageVersion));
                }
                if (!flag2 && !WsrmUtilities.IsWsrmAction(reliableMessagingVersion, action))
                {
                    return(info);
                }
                ValidateMustUnderstand(messageVersion, message);
            }
            catch (InternalFaultException exception)
            {
                if (System.ServiceModel.DiagnosticUtility.ShouldTraceInformation)
                {
                    System.ServiceModel.DiagnosticUtility.ExceptionUtility.TraceHandledException(exception, TraceEventType.Information);
                }
                info.FaultReply     = exception.FaultReply;
                info.faultException = exception.InnerException;
            }
            catch (CommunicationException exception2)
            {
                if (System.ServiceModel.DiagnosticUtility.ShouldTraceInformation)
                {
                    System.ServiceModel.DiagnosticUtility.ExceptionUtility.TraceHandledException(exception2, TraceEventType.Information);
                }
                if (isFault)
                {
                    info.parsingException = exception2;
                    return(info);
                }
                FaultConverter defaultFaultConverter = channel.GetProperty <FaultConverter>();
                if (defaultFaultConverter == null)
                {
                    defaultFaultConverter = FaultConverter.GetDefaultFaultConverter(messageVersion);
                }
                if (defaultFaultConverter.TryCreateFaultMessage(exception2, out info.faultReply))
                {
                    info.faultException = new ProtocolException(System.ServiceModel.SR.GetString("MessageExceptionOccurred"), exception2);
                    return(info);
                }
                info.parsingException = new ProtocolException(System.ServiceModel.SR.GetString("MessageExceptionOccurred"), exception2);
            }
            catch (XmlException exception3)
            {
                if (System.ServiceModel.DiagnosticUtility.ShouldTraceInformation)
                {
                    System.ServiceModel.DiagnosticUtility.ExceptionUtility.TraceHandledException(exception3, TraceEventType.Information);
                }
                info.parsingException = new ProtocolException(System.ServiceModel.SR.GetString("MessageExceptionOccurred"), exception3);
            }
            return(info);
        }