예제 #1
0
 internal static Message CreateMessage(MessageVersion version, ActionHeader actionHeader)
 {
     if (version == null)
     {
         throw System.ServiceModel.DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentNullException("version"));
     }
     return(new BodyWriterMessage(version, actionHeader, EmptyBodyWriter.Value));
 }
        internal static Message CreateCreateSequenceResponse(MessageVersion messageVersion, ReliableMessagingVersion reliableMessagingVersion, bool duplex, CreateSequenceInfo createSequenceInfo, bool ordered, UniqueId inputId, EndpointAddress acceptAcksTo)
        {
            CreateSequenceResponse body = new CreateSequenceResponse(messageVersion.Addressing, reliableMessagingVersion)
            {
                Identifier = inputId,
                Expires    = createSequenceInfo.Expires,
                Ordered    = ordered
            };

            if (duplex)
            {
                body.AcceptAcksTo = acceptAcksTo;
            }
            return(Message.CreateMessage(messageVersion, ActionHeader.Create(WsrmIndex.GetCreateSequenceResponseAction(reliableMessagingVersion), messageVersion.Addressing), body));
        }
예제 #3
0
        protected override ActionHeader GetActionHeader(string element)
        {
            WsrmFeb2005Dictionary dictionary = XD.WsrmFeb2005Dictionary;

            if (element == "AckRequested")
            {
                if (this.ackRequestedActionHeader == null)
                {
                    this.ackRequestedActionHeader = ActionHeader.Create(dictionary.AckRequestedAction, this.addressingVersion);
                }
                return(this.ackRequestedActionHeader);
            }
            if (element == "CreateSequence")
            {
                if (this.createSequenceActionHeader == null)
                {
                    this.createSequenceActionHeader = ActionHeader.Create(dictionary.CreateSequenceAction, this.addressingVersion);
                }
                return(this.createSequenceActionHeader);
            }
            if (element == "SequenceAcknowledgement")
            {
                if (this.sequenceAcknowledgementActionHeader == null)
                {
                    this.sequenceAcknowledgementActionHeader = ActionHeader.Create(dictionary.SequenceAcknowledgementAction, this.addressingVersion);
                }
                return(this.sequenceAcknowledgementActionHeader);
            }
            if (!(element == "TerminateSequence"))
            {
                throw Fx.AssertAndThrow("Element not supported.");
            }
            if (this.terminateSequenceActionHeader == null)
            {
                this.terminateSequenceActionHeader = ActionHeader.Create(dictionary.TerminateSequenceAction, this.addressingVersion);
            }
            return(this.terminateSequenceActionHeader);
        }
 protected override ActionHeader GetActionHeader(string element)
 {
     WsrmFeb2005Dictionary dictionary = XD.WsrmFeb2005Dictionary;
     if (element == "AckRequested")
     {
         if (this.ackRequestedActionHeader == null)
         {
             this.ackRequestedActionHeader = ActionHeader.Create(dictionary.AckRequestedAction, this.addressingVersion);
         }
         return this.ackRequestedActionHeader;
     }
     if (element == "CreateSequence")
     {
         if (this.createSequenceActionHeader == null)
         {
             this.createSequenceActionHeader = ActionHeader.Create(dictionary.CreateSequenceAction, this.addressingVersion);
         }
         return this.createSequenceActionHeader;
     }
     if (element == "SequenceAcknowledgement")
     {
         if (this.sequenceAcknowledgementActionHeader == null)
         {
             this.sequenceAcknowledgementActionHeader = ActionHeader.Create(dictionary.SequenceAcknowledgementAction, this.addressingVersion);
         }
         return this.sequenceAcknowledgementActionHeader;
     }
     if (!(element == "TerminateSequence"))
     {
         throw Fx.AssertAndThrow("Element not supported.");
     }
     if (this.terminateSequenceActionHeader == null)
     {
         this.terminateSequenceActionHeader = ActionHeader.Create(dictionary.TerminateSequenceAction, this.addressingVersion);
     }
     return this.terminateSequenceActionHeader;
 }
 public BodyWriterMessage(MessageVersion version, ActionHeader actionHeader, System.ServiceModel.Channels.BodyWriter bodyWriter) : this(bodyWriter)
 {
     this.headers = new MessageHeaders(version);
     this.headers.SetActionHeader(actionHeader);
 }
        public Message TryCreateMessage(byte[] buffer, int offset, int size, BufferManager bufferManager, BufferedMessageData messageData)
        {
            RelatesToHeader     header;
            MessageIDHeader     header2;
            XmlDictionaryString anonymous;
            int num6;
            XmlDictionaryString str2;
            int num  = offset;
            int num2 = size;
            int num3 = BinaryFormatParser.MatchBytes(buffer, num, num2, commonFragment);

            if (num3 == 0)
            {
                return(null);
            }
            num  += num3;
            num2 -= num3;
            num3  = BinaryFormatParser.MatchKey(buffer, num, num2);
            if (num3 == 0)
            {
                return(null);
            }
            int num4 = num;
            int num5 = num3;

            num  += num3;
            num2 -= num3;
            num3  = BinaryFormatParser.MatchBytes(buffer, num, num2, requestFragment1);
            if (num3 != 0)
            {
                num  += num3;
                num2 -= num3;
                num3  = BinaryFormatParser.MatchUniqueID(buffer, num, num2);
                if (num3 == 0)
                {
                    return(null);
                }
                int num7 = num;
                int num8 = num3;
                num  += num3;
                num2 -= num3;
                num3  = BinaryFormatParser.MatchBytes(buffer, num, num2, requestFragment2);
                if (num3 == 0)
                {
                    return(null);
                }
                num  += num3;
                num2 -= num3;
                if (BinaryFormatParser.MatchAttributeNode(buffer, num, num2))
                {
                    return(null);
                }
                header2 = MessageIDHeader.Create(BinaryFormatParser.ParseUniqueID(buffer, num7, num8), this.messageVersion.Addressing);
                header  = null;
                if (!this.readerSession.TryLookup(1, out anonymous))
                {
                    return(null);
                }
                num6 = (requestFragment1.Length + num8) + requestFragment2.Length;
            }
            else
            {
                num3 = BinaryFormatParser.MatchBytes(buffer, num, num2, responseFragment1);
                if (num3 == 0)
                {
                    return(null);
                }
                num  += num3;
                num2 -= num3;
                num3  = BinaryFormatParser.MatchUniqueID(buffer, num, num2);
                if (num3 == 0)
                {
                    return(null);
                }
                int num9  = num;
                int num10 = num3;
                num  += num3;
                num2 -= num3;
                num3  = BinaryFormatParser.MatchBytes(buffer, num, num2, responseFragment2);
                if (num3 == 0)
                {
                    return(null);
                }
                num  += num3;
                num2 -= num3;
                if (BinaryFormatParser.MatchAttributeNode(buffer, num, num2))
                {
                    return(null);
                }
                header    = RelatesToHeader.Create(BinaryFormatParser.ParseUniqueID(buffer, num9, num10), this.messageVersion.Addressing);
                header2   = null;
                anonymous = XD.Addressing10Dictionary.Anonymous;
                num6      = (responseFragment1.Length + num10) + responseFragment2.Length;
            }
            num6 += commonFragment.Length + num5;
            int key = BinaryFormatParser.ParseKey(buffer, num4, num5);

            if (!this.TryLookupKey(key, out str2))
            {
                return(null);
            }
            ActionHeader actionHeader = ActionHeader.Create(str2, this.messageVersion.Addressing);

            if (this.toHeader == null)
            {
                this.toHeader = ToHeader.Create(new Uri(anonymous.Value), this.messageVersion.Addressing);
            }
            int num12 = num6 - bodyFragment.Length;

            offset += num12;
            size   -= num12;
            Buffer.BlockCopy(bodyFragment, 0, buffer, offset, bodyFragment.Length);
            messageData.Open(new ArraySegment <byte>(buffer, offset, size), bufferManager);
            PatternMessage message = new PatternMessage(messageData, this.messageVersion);
            MessageHeaders headers = message.Headers;

            headers.AddActionHeader(actionHeader);
            if (header2 != null)
            {
                headers.AddMessageIDHeader(header2);
                headers.AddReplyToHeader(ReplyToHeader.AnonymousReplyTo10);
            }
            else
            {
                headers.AddRelatesToHeader(header);
            }
            headers.AddToHeader(this.toHeader);
            return(message);
        }
예제 #7
0
 public BodyWriterMessage(MessageVersion version, ActionHeader actionHeader, System.ServiceModel.Channels.BodyWriter bodyWriter) : this(bodyWriter)
 {
     this.headers = new MessageHeaders(version);
     this.headers.SetActionHeader(actionHeader);
 }