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); }
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)); }
public RequestContext EndReceiveRequest(IAsyncResult result) { RequestContext requestContext = innerReplyChannel.EndReceiveRequest(result); // Read the context id from the incoming message. ReadContextId(requestContext.RequestMessage); return(requestContext); }
void OnReceive(IAsyncResult result) { if (result.CompletedSynchronously) { return; } IReplyChannel channel = (IReplyChannel)result.AsyncState; RequestContext context = channel.EndReceiveRequest(result); if (HandleRequest(channel, context)) { ReceiveRequest(channel); } }
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); } }
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; } } }
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(); } }
protected override RequestContext EndReceiveRequest(IAsyncResult result) { return(_innerChannel.EndReceiveRequest(result)); }
public RequestContext EndReceiveRequest(IAsyncResult result) { return(_innerChannel.EndReceiveRequest(result)); }
public override RequestContext EndReceiveRequest(IAsyncResult result) { return(Inspect(inner.EndReceiveRequest(result))); }
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; } } }
public virtual RequestContext EndReceiveRequest(IAsyncResult result) { return(inner.EndReceiveRequest(result)); }
public RequestContext EndReceiveRequest(IAsyncResult result) => WrapRequestContext(_innerChannel.EndReceiveRequest(result));
public RequestContext EndReceiveRequest(System.IAsyncResult result) { Console.WriteLine("MyReplyChannel.EndReceiveRequest()"); return(InnerChannel.EndReceiveRequest(result)); }