public void FullRequest()
        {
            EndpointIdentity identity =
                new X509CertificateEndpointIdentity(new X509Certificate2("Test/Resources/test.pfx", "mono"));
            EndpointAddress address =
                new EndpointAddress(new Uri("stream:dummy"), identity);

            Message mreq   = Message.CreateMessage(MessageVersion.Default, "myAction");
            Message mreply = null;

            XmlWriterSettings settings = new XmlWriterSettings();

            settings.Indent = true;

            // listener setup
            ReplyHandler replyHandler = delegate(Message rinput)
            {
                mreply = rinput;
            };
            RequestReceiver receiver = delegate()
            {
                return(mreq);
            };
            IChannelListener <IReplyChannel> listener = CreateListener(replyHandler, receiver);

            listener.Open();
            IReplyChannel reply = listener.AcceptChannel();

            reply.Open();

            RequestSender reqHandler = delegate(Message input)
            {
                try
                {
                    // sync version somehow causes an infinite loop (!?)
                    RequestContext ctx = reply.EndReceiveRequest(reply.BeginReceiveRequest(TimeSpan.FromSeconds(5), null, null));
//					RequestContext ctx = reply.ReceiveRequest (TimeSpan.FromSeconds (5));
                    Console.Error.WriteLine("Acquired RequestContext.");
                    ctx.Reply(input);
                }
                catch (Exception ex)
                {
                    Console.Error.WriteLine("ERROR during processing a request in FullRequest()");
                    Console.Error.WriteLine(ex);
                    Console.Error.Flush();
                    throw;
                }
                return(mreply);
            };
            CustomBinding b = CreateBinding(reqHandler);

            IRequestChannel ch = ChannelFactory <IRequestChannel> .CreateChannel(b, address);

            ch.Open();
            Console.Error.WriteLine("**** starting a request  ****");
            IAsyncResult async = ch.BeginRequest(mreq, null, null);

            Console.Error.WriteLine("**** request started. ****");
            Message res = ch.EndRequest(async);
        }
コード例 #2
0
        public void ReceiveRequest()
        {
            // Seems like this method is invoked to send a reply
            // with related to "already created" SOAP fault.
            //
            // It is still not understandable that this delegate
            // is invoked as an infinite loop ...
            ReplyHandler handler = delegate(Message input) {
                Console.Error.WriteLine("Processing a reply.");
                // a:InvalidSecurity
                // An error occurred when verifying security for the message.
                Assert.IsTrue(input.IsFault);
                throw new ApplicationException();
            };
            Message         msg      = Message.CreateMessage(MessageVersion.Default, "myAction");
            RequestReceiver receiver = delegate() {
                return(msg);
            };
            IChannelListener <IReplyChannel> listener = CreateListener(handler, receiver);

            listener.Open();
            IReplyChannel reply = listener.AcceptChannel();

            reply.Open();
            RequestContext ctx = reply.EndReceiveRequest(reply.BeginReceiveRequest(null, null));
        }
コード例 #3
0
        public RequestContext EndReceiveRequest(IAsyncResult result)
        {
            RequestContext requestContext =
                innerReplyChannel.EndReceiveRequest(result);

            // Read the context id from the incoming message.
            ReadContextId(requestContext.RequestMessage);
            return(requestContext);
        }
コード例 #4
0
        void OnReceive(IAsyncResult result)
        {
            if (result.CompletedSynchronously)
            {
                return;
            }

            IReplyChannel  channel = (IReplyChannel)result.AsyncState;
            RequestContext context = channel.EndReceiveRequest(result);

            if (HandleRequest(channel, context))
            {
                ReceiveRequest(channel);
            }
        }
コード例 #5
0
        public void AcceptRequest(IAsyncResult ar)
        {
            IReplyChannel channel = ar.AsyncState as IReplyChannel;

            try
            {
                RequestContext context = channel.EndReceiveRequest(ar);
                channel.BeginReceiveRequest(AcceptRequest, channel);
                ProcessRequest(context);
            }
            catch (TimeoutException)
            {
                channel.BeginReceiveRequest(AcceptRequest, channel);
            }
        }
コード例 #6
0
        void ReceiveRequest(IReplyChannel channel)
        {
            for (; ;)
            {
                IAsyncResult result = channel.BeginReceiveRequest(TimeSpan.MaxValue, this.onReceive, channel);
                if (!result.CompletedSynchronously)
                {
                    break;
                }

                RequestContext context = channel.EndReceiveRequest(result);
                if (!HandleRequest(channel, context))
                {
                    break;
                }
            }
        }
コード例 #7
0
        private void RequestAccepted(IAsyncResult result)
        {
            IReplyChannel replyChannel = (IReplyChannel)result.AsyncState;

            try
            {
                var requestContext = replyChannel.EndReceiveRequest(result);

                if (requestContext != null)
                {
                    var context = new AzureServiceBusHttpContext(requestContext);

                    context.Items["ReplyChannel"] = replyChannel;

                    ProcessRequest(context);
                }
            }
            catch (Exception exc)
            {
                Manager.Log("Request Accepted: " + exc.Message, "Proxy");
                replyChannel.Abort();
            }
        }
コード例 #8
0
 protected override RequestContext EndReceiveRequest(IAsyncResult result)
 {
     return(_innerChannel.EndReceiveRequest(result));
 }
コード例 #9
0
 public RequestContext EndReceiveRequest(IAsyncResult result)
 {
     return(_innerChannel.EndReceiveRequest(result));
 }
コード例 #10
0
 public override RequestContext EndReceiveRequest(IAsyncResult result)
 {
     return(Inspect(inner.EndReceiveRequest(result)));
 }
コード例 #11
0
ファイル: Service.cs プロジェクト: ssickles/archive
        void ReceiveRequest(IReplyChannel channel)
        {
            for (; ; )
            {
                IAsyncResult result = channel.BeginReceiveRequest(TimeSpan.MaxValue, this.onReceive, channel);
                if (!result.CompletedSynchronously)
                    break;

                RequestContext context = channel.EndReceiveRequest(result);
                if (!HandleRequest(channel, context))
                {
                    break;
                }
            }
        }
コード例 #12
0
 public virtual RequestContext EndReceiveRequest(IAsyncResult result)
 {
     return(inner.EndReceiveRequest(result));
 }
コード例 #13
0
 public RequestContext EndReceiveRequest(IAsyncResult result)
 => WrapRequestContext(_innerChannel.EndReceiveRequest(result));
コード例 #14
0
 public RequestContext EndReceiveRequest(System.IAsyncResult result)
 {
     Console.WriteLine("MyReplyChannel.EndReceiveRequest()");
     return(InnerChannel.EndReceiveRequest(result));
 }