2 using System.Collections.Generic;
3 using System.ServiceModel;
4 using System.ServiceModel.Channels;
5 using System.ServiceModel.Security;
6 using System.ServiceModel.Security.Tokens;
9 namespace System.ServiceModel.Dispatcher
11 internal class InputOrReplyRequestProcessor : BaseRequestProcessor
13 DispatchRuntime dispatch_runtime;
14 IChannel reply_or_input;
16 public InputOrReplyRequestProcessor (DispatchRuntime runtime, IChannel replyOrInput)
18 Init (runtime, reply_or_input);
21 InitializeChain.AddHandler (new InitializingHandler ());
24 ProcessingChain.AddHandler (new PostReceiveRequestHandler ()).
25 AddHandler(new SecurityHandler ()).
26 AddHandler(new OperationInvokerHandler ()).
27 AddHandler(new ReplyHandler (replyOrInput));
30 ErrorChain.AddHandler (new ErrorProcessingHandler (replyOrInput));
33 FinalizationChain.AddHandler (new FinalizeProcessingHandler ());
36 void Init (DispatchRuntime runtime, IChannel replyOrInput)
38 dispatch_runtime = runtime;
39 reply_or_input = replyOrInput;
42 public void ProcessInput (Message message)
44 OperationContext opcx = CreateOperationContext (message);
45 ProcessRequest (new MessageProcessingContext (opcx));
48 public void ProcessReply (RequestContext rc)
50 OperationContext opcx = CreateOperationContext (rc.RequestMessage);
51 opcx.RequestContext = rc;
52 ProcessRequest (new MessageProcessingContext (opcx));
55 OperationContext CreateOperationContext (Message incoming)
57 ServiceRuntimeChannel contextChannel = new ServiceRuntimeChannel (reply_or_input,
58 dispatch_runtime.ChannelDispatcher.DefaultOpenTimeout,
59 dispatch_runtime.ChannelDispatcher.DefaultCloseTimeout);
60 OperationContext opCtx = new OperationContext (contextChannel);
61 opCtx.IncomingMessage = incoming;
62 opCtx.EndpointDispatcher = dispatch_runtime.EndpointDispatcher;