Files
mono/mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/InputOrReplyRequestProcessor.cs
T
Atsushi Eno 3966750e29 2010-06-03 Atsushi Enomoto <[email protected]>
* ContractDescriptionGenerator.cs : Now callback contract methods are
	  also reflected into OperationDescription as well as those from non-
	  callback contract. Callback methods have reverse MessageDirection,
	  so adjust them.
	* ContractDescription.cs, ServiceEndpoint.cs, TypedMessageConverter.cs :
	  A bit of renaming / reflect method call changes.

	* EndpointDispatcher.cs, DispatchRuntime.cs, ClientRuntime.cs :
	  now Callback[Dispatch|Client]Runtime properties are always filled
	  so that users can configure the callback runtimes (not sure such
	  configured runtimes work fine yet, but it is a required step).
	* InputOrReplyRequestProcessor.cs : instead of HasCallbackRuntime
	  hack, use CallbackClientRuntime.CallbackContractType for checking
	  callback existence.

	* ClientProxyGenerator.cs : CreateProxyType now carefully considers
	  requested proxy type, contract type and callback contract type.
	  i.e. now the resulting proxy has implemented methods for callbacks
	  that are also filled at ContractDescription.
	* ClientRuntimeChannel.cs : reflect some method call changes.


svn path=/trunk/mcs/; revision=158412
2010-06-03 16:33:31 +00:00

71 lines
2.2 KiB
C#

using System;
using System.Collections.Generic;
using System.ServiceModel;
using System.ServiceModel.Channels;
using System.ServiceModel.Security;
using System.ServiceModel.Security.Tokens;
using System.Text;
using System.ServiceModel.MonoInternal;
namespace System.ServiceModel.Dispatcher
{
internal class InputOrReplyRequestProcessor : BaseRequestProcessor
{
DispatchRuntime dispatch_runtime;
IChannel reply_or_input;
public InputOrReplyRequestProcessor (DispatchRuntime runtime, IChannel replyOrInput)
{
Init (runtime, replyOrInput);
//initialization
InitializeChain.AddHandler (new InitializingHandler ());
//processing
ProcessingChain.AddHandler (new PostReceiveRequestHandler ()).
AddHandler(new SecurityHandler ()).
AddHandler(new OperationInvokerHandler (replyOrInput));
//errors
ErrorChain.AddHandler (new ErrorProcessingHandler (replyOrInput));
//finalize
FinalizationChain.AddHandler (new FinalizeProcessingHandler ());
}
void Init (DispatchRuntime runtime, IChannel replyOrInput)
{
dispatch_runtime = runtime;
reply_or_input = replyOrInput;
}
public void ProcessInput (Message message)
{
OperationContext opcx = CreateOperationContext (message);
ProcessRequest (new MessageProcessingContext (opcx));
}
public void ProcessReply (RequestContext rc)
{
OperationContext opcx = CreateOperationContext (rc.RequestMessage);
opcx.RequestContext = rc;
ProcessRequest (new MessageProcessingContext (opcx));
}
OperationContext CreateOperationContext (Message incoming)
{
ServiceRuntimeChannel contextChannel;
if (dispatch_runtime.CallbackClientRuntime.CallbackClientType != null) {
var type = ServiceProxyGenerator.CreateCallbackProxyType (dispatch_runtime.Type, dispatch_runtime.CallbackClientRuntime.CallbackClientType);
contextChannel = (ServiceRuntimeChannel) Activator.CreateInstance (type, new object [] {reply_or_input, dispatch_runtime});
}
else
contextChannel = new ServiceRuntimeChannel (reply_or_input, dispatch_runtime);
OperationContext opCtx = new OperationContext (contextChannel);
opCtx.IncomingMessage = incoming;
opCtx.EndpointDispatcher = dispatch_runtime.EndpointDispatcher;
return opCtx;
}
}
}