/// <summary>
        ///
        /// </summary>
        public ServerProcessing ProcessMessage(IServerChannelSinkStack sinkStack, IMessage requestMsg, ITransportHeaders requestHeaders, Stream requestStream,
                                               out IMessage responseMsg, out ITransportHeaders responseHeaders, out Stream responseStream)
        {
            // scope state
            ServerProcessing servproc = ServerProcessing.Complete;

            responseMsg     = null;
            responseHeaders = null;
            responseStream  = new MemoryStream();
            IMethodCallMessage mcm = null;
            BinaryFormatter    bf  = new BinaryFormatter();

            try
            {
                //Are we in the business?
                if (_Next != null)
                {
                    if (requestMsg == null && requestStream != null)
                    {
                        // we are supporting only binary formatter
                        requestMsg = (IMessage)bf.Deserialize(requestStream);
                        requestStream.Close();
                    }

                    mcm = requestMsg as IMethodCallMessage;
                    if (mcm == null)
                    {
                        throw new NullReferenceException("IMethodCallMessage after deserialization");
                    }

                    // LogicalCallContext
                    LCC.CopyFrom(mcm);
                    LogicalWorkflowContext lwc = LCC.LogicalWorkflowContext;
                    Guid workflowInstanceId    = lwc.GetAndClearWorkflowId();
                    bool bGetWorkflowById      = !workflowInstanceId.Equals(Guid.Empty);

                    // create workflow
                    Invoker invoker = null;
                    if (bGetWorkflowById)
                    {
                        invoker = WorkflowInvoker.Create(workflowInstanceId);
                    }
                    else
                    {
                        string endpoint = mcm.Uri;
                        if (string.IsNullOrEmpty(endpoint))
                        {
                            endpoint = requestHeaders["__RequestUri"] as string;
                        }
                        if (string.IsNullOrEmpty(endpoint))
                        {
                            throw new NullReferenceException("Internal error - missing endpoint");
                        }

                        // create workflow instance
                        Type workflowType = RemotingServices.GetServerTypeForUri(endpoint.TrimStart('/'));
                        invoker = WorkflowInvoker.Create(workflowType, lwc.WorkflowInitData);
                    }

                    // send remoting message to the workflow
                    invoker.SendMessage(mcm);

                    // handle response
                    if (!RemotingServices.IsOneWay(mcm.MethodBase))
                    {
                        // wait for response
                        invoker.WaitForResponse(_Provider.TimeOut);
                        object response = invoker.GetResponse <object>();

                        // return message back to the caller (Note that this version is not allow to change a CallContext!!)
                        responseMsg = (IMessage) new ReturnMessage(response, null, 0, null, mcm);
                    }
                }
                else
                {
                    throw new RemotingException("Internal error in the channel stack");
                }
            }
            catch (Exception ex)
            {
                Trace.WriteLine(ex);
                responseMsg = (IMessage) new ReturnMessage(ex, mcm);
            }
            finally
            {
                responseHeaders = requestHeaders;
                if (responseMsg != null)
                {
                    // serialize response to the wire transport
                    bf.Serialize(responseStream, responseMsg);
                    responseStream.Position = 0;
                }
            }
            return(servproc);
        }