Esempio n. 1
0
        public static bool TryCreateFault11(ReliableMessagingVersion reliableMessagingVersion, Message message,
                                            MessageFault fault, int index, out WsrmHeaderFault wsrmFault)
        {
            if (index == -1)
            {
                wsrmFault = null;
                return(false);
            }

            // All wsrm header faults must be sender or receiver faults.
            if (!fault.Code.IsSenderFault && !fault.Code.IsReceiverFault)
            {
                wsrmFault = null;
                return(false);
            }

            string subcodeName = WsrmSequenceFaultHeader.GetSubcode(message.Headers.GetReaderAtHeader(index),
                                                                    reliableMessagingVersion);

            if (subcodeName == null)
            {
                wsrmFault = null;
                return(false);
            }

            string detailName;
            string detailNamespace;

            LookupDetailInformation(reliableMessagingVersion, subcodeName, out detailName, out detailNamespace);

            XmlDictionaryReader detailReader = WsrmSequenceFaultHeader.GetReaderAtDetailContents(detailName,
                                                                                                 detailNamespace, message.Headers.GetReaderAtHeader(index), reliableMessagingVersion);

            if (detailReader == null)
            {
                wsrmFault = null;
                return(false);
            }

            wsrmFault = CreateWsrmHeaderFault(reliableMessagingVersion, fault.Code, subcodeName, fault.Reason,
                                              detailReader);
            if (wsrmFault != null)
            {
                message.Headers.UnderstoodHeaders.Add(message.Headers[index]);
                return(true);
            }
            else
            {
                return(false);
            }
        }
        public static bool TryCreateFault11(ReliableMessagingVersion reliableMessagingVersion, Message message, MessageFault fault, int index, out WsrmHeaderFault wsrmFault)
        {
            string str2;
            string str3;

            if (index == -1)
            {
                wsrmFault = null;
                return(false);
            }
            if (!fault.Code.IsSenderFault && !fault.Code.IsReceiverFault)
            {
                wsrmFault = null;
                return(false);
            }
            string subcode = WsrmSequenceFaultHeader.GetSubcode(message.Headers.GetReaderAtHeader(index), reliableMessagingVersion);

            if (subcode == null)
            {
                wsrmFault = null;
                return(false);
            }
            LookupDetailInformation(reliableMessagingVersion, subcode, out str2, out str3);
            XmlDictionaryReader detailReader = WsrmSequenceFaultHeader.GetReaderAtDetailContents(str2, str3, message.Headers.GetReaderAtHeader(index), reliableMessagingVersion);

            if (detailReader == null)
            {
                wsrmFault = null;
                return(false);
            }
            wsrmFault = CreateWsrmHeaderFault(reliableMessagingVersion, fault.Code, subcode, fault.Reason, detailReader);
            if (wsrmFault != null)
            {
                message.Headers.UnderstoodHeaders.Add(message.Headers[index]);
                return(true);
            }
            return(false);
        }