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;
8 using System.ServiceModel.MonoInternal;
10 namespace System.ServiceModel.Dispatcher
12 internal class InputOrReplyRequestProcessor : BaseRequestProcessor
14 DispatchRuntime dispatch_runtime;
15 IChannel reply_or_input;
17 public InputOrReplyRequestProcessor (DispatchRuntime runtime, IChannel replyOrInput)
19 Init (runtime, replyOrInput);
22 InitializeChain.AddHandler (new InitializingHandler ());
25 ProcessingChain.AddHandler (new PostReceiveRequestHandler ()).
26 AddHandler (new OperationInvokerHandler (replyOrInput));
29 ErrorChain.AddHandler (new ErrorProcessingHandler (replyOrInput));
32 FinalizationChain.AddHandler (new FinalizeProcessingHandler ());
35 void Init (DispatchRuntime runtime, IChannel replyOrInput)
37 dispatch_runtime = runtime;
38 reply_or_input = replyOrInput;
41 public void ProcessInput (Message message)
43 OperationContext opcx = CreateOperationContext (message);
44 ProcessRequest (new MessageProcessingContext (opcx));
47 public void ProcessReply (RequestContext rc)
49 OperationContext opcx = CreateOperationContext (rc.RequestMessage);
50 opcx.RequestContext = rc;
51 ProcessRequest (new MessageProcessingContext (opcx));
54 OperationContext CreateOperationContext (Message incoming)
56 ServiceRuntimeChannel contextChannel;
57 if (dispatch_runtime.CallbackClientRuntime.CallbackClientType != null) {
58 var type = ServiceProxyGenerator.CreateCallbackProxyType (dispatch_runtime, dispatch_runtime.CallbackClientRuntime.CallbackClientType);
59 contextChannel = (ServiceRuntimeChannel) Activator.CreateInstance (type, new object [] {reply_or_input, dispatch_runtime});
62 contextChannel = new ServiceRuntimeChannel (reply_or_input, dispatch_runtime);
63 contextChannel.Open (); // FIXME: timeout?
64 OperationContext opCtx = new OperationContext (contextChannel);
65 opCtx.IncomingMessage = incoming;
66 opCtx.EndpointDispatcher = dispatch_runtime.EndpointDispatcher;