상속: IClientChannelSinkStack, IClientResponseChannelSinkStack
        public IMessageCtrl AsyncProcessMessage(IMessage msg, IMessageSink replySink)
        {
            IMethodCallMessage mcm = (IMethodCallMessage)msg;
            IMessage           retMsg;

            try
            {
                // serialize message
                ITransportHeaders headers;
                Stream            requestStream;
                SerializeMessage(msg, out headers, out requestStream);

                // process message
                ClientChannelSinkStack sinkStack = new ClientChannelSinkStack(replySink);
                sinkStack.Push(this, msg);
                _nextSink.AsyncProcessRequest(sinkStack, msg, headers, requestStream);
            }
            catch (Exception e)
            {
                retMsg = new ReturnMessage(e, mcm);
                if (replySink != null)
                {
                    replySink.SyncProcessMessage(retMsg);
                }
            }

            return(null);
        } // AsyncProcessMessage
예제 #2
0
        public IMessageCtrl AsyncProcessMessage(IMessage msg,
                                                IMessageSink replySink)
        {
            ITransportHeaders transportHeaders = new TransportHeaders();

            transportHeaders[CommonTransportKeys.RequestUri] = ((IMethodCallMessage)msg).Uri;
            transportHeaders["Content-Type"] = "application/octet-stream";

            Stream stream = _nextInChain.GetRequestStream(msg, transportHeaders);

            if (stream == null)
            {
                stream = new MemoryStream();
            }

            _binaryCore.Serializer.Serialize(stream, msg, null);
            if (stream is MemoryStream)
            {
                stream.Position = 0;
            }

            ClientChannelSinkStack stack = new ClientChannelSinkStack(replySink);

            stack.Push(this, msg);

            _nextInChain.AsyncProcessRequest(stack, msg, transportHeaders, stream);

            // FIXME: No idea about how to implement IMessageCtrl
            return(null);
        }
예제 #3
0
    public IMessageCtrl AsyncProcessMessage (IMessage msg,
                                             IMessageSink replySink)
    {
      Stream reqStream;
      FormatMessage (msg, out reqStream);

      TransportHeaders reqHeaders = new TransportHeaders();
      ClientChannelSinkStack stack = new ClientChannelSinkStack (replySink);
      stack.Push (this, msg);

      _next.AsyncProcessRequest (stack, msg, reqHeaders, reqStream);

      return null;
    }
        public IMessageCtrl AsyncProcessMessage(IMessage msg,
                                                IMessageSink replySink)
        {
            Stream               requestStream;
            ITransportHeaders    requestHeaders;
            SoapMessageFormatter soapMsgFormatter;

            SerializeMessage(msg, out requestStream, out requestHeaders,
                             out soapMsgFormatter);

            ClientChannelSinkStack stack = new ClientChannelSinkStack(replySink);

            stack.Push(this, new CallData(msg, soapMsgFormatter));

            _nextChannelSink.AsyncProcessRequest(stack, msg, requestHeaders, requestStream);

            return(null);
        }
 public IMessageCtrl AsyncProcessMessage(IMessage msg, IMessageSink replySink)
 {
     IMethodCallMessage mcm = (IMethodCallMessage) msg;
     try
     {
         ITransportHeaders headers;
         Stream stream;
         this.SerializeMessage(mcm, out headers, out stream);
         ClientChannelSinkStack sinkStack = new ClientChannelSinkStack(replySink);
         sinkStack.Push(this, mcm);
         this._nextSink.AsyncProcessRequest(sinkStack, msg, headers, stream);
     }
     catch (Exception exception)
     {
         IMessage message2 = new ReturnMessage(exception, mcm);
         if (replySink != null)
         {
             replySink.SyncProcessMessage(message2);
         }
     }
     return null;
 }
        public IMessageCtrl AsyncProcessMessage(IMessage msg, IMessageSink replySink)
        {
            IMethodCallMessage mcm = (IMethodCallMessage)msg;

            try
            {
                ITransportHeaders headers;
                Stream            stream;
                this.SerializeMessage(msg, out headers, out stream);
                ClientChannelSinkStack sinkStack = new ClientChannelSinkStack(replySink);
                sinkStack.Push(this, msg);
                this._nextSink.AsyncProcessRequest(sinkStack, msg, headers, stream);
            }
            catch (Exception exception)
            {
                IMessage message2 = new ReturnMessage(exception, mcm);
                if (replySink != null)
                {
                    replySink.SyncProcessMessage(message2);
                }
            }
            return(null);
        }
예제 #7
0
        public IMessageCtrl AsyncProcessMessage(IMessage msg, IMessageSink replySink)
        {
            IMethodCallMessage mcm = (IMethodCallMessage)msg;
            IMessage retMsg;

            try
            {
                // serialize message
                ITransportHeaders headers;
                Stream requestStream;
                SerializeMessage(msg, out headers, out requestStream);
            
                // process message
                ClientChannelSinkStack sinkStack = new ClientChannelSinkStack(replySink);
                sinkStack.Push(this, msg);
                _nextSink.AsyncProcessRequest(sinkStack, msg, headers, requestStream);
            }
            catch (Exception e)
            {
                retMsg = new ReturnMessage(e, mcm);
                if (replySink != null)
                    replySink.SyncProcessMessage(retMsg);
            }
                                          
            return null;
        } // AsyncProcessMessage
예제 #8
0
		public IMessageCtrl AsyncProcessMessage (IMessage msg,
			IMessageSink replySink)
		{
			ITransportHeaders transportHeaders = new TransportHeaders();
			transportHeaders[CommonTransportKeys.RequestUri] = ((IMethodCallMessage)msg).Uri;
			transportHeaders["Content-Type"] = "application/octet-stream";

			Stream stream = _nextInChain.GetRequestStream(msg, transportHeaders);
			if (stream == null) stream = new MemoryStream ();

			_binaryCore.Serializer.Serialize (stream, msg, null);
			if (stream is MemoryStream) stream.Position = 0;

			ClientChannelSinkStack stack = new ClientChannelSinkStack(replySink);
			stack.Push (this, msg);

			_nextInChain.AsyncProcessRequest (stack, msg, transportHeaders, stream);

			// FIXME: No idea about how to implement IMessageCtrl
			return null;	
		}
            public IMessageCtrl AsyncProcessMessage(IMessage msg, IMessageSink replySink)
            {
                var methodCallMessage = (IMethodCallMessage)msg;
                try
                {
                    ITransportHeaders requestHeaders;
                    Stream requestStream;
                    SerializeRequestMessage(methodCallMessage, out requestHeaders, out requestStream);

                    var sinkStack = new ClientChannelSinkStack(replySink);
                    sinkStack.Push(this, methodCallMessage);

                    this._nextChannelSink.AsyncProcessRequest(sinkStack, methodCallMessage, requestHeaders, requestStream);
                }
                catch (Exception ex)
                {
                    var errorMessage = new ReturnMessage(ex, methodCallMessage);
                    if (replySink != null)
                    {
                        replySink.SyncProcessMessage(errorMessage);
                    }
                }

                return null;
            }
		public IMessageCtrl AsyncProcessMessage(IMessage requestMsg, IMessageSink replySink)
		{
			// parameters validation
			IMethodCallMessage methodCall = (requestMsg as IMethodCallMessage);
			if (methodCall == null)
				throw new NotSupportedException();

			try
			{
				// serialize request
				ITransportHeaders requestHeaders;
				Stream requestStream;
				SerializeRequest(methodCall, out requestHeaders, out requestStream);

				// create sink stack for async request processing
				ClientChannelSinkStack sinkStack = new ClientChannelSinkStack(replySink);
				sinkStack.Push(this, requestMsg);	// save request message as state

				// call next sink to dispatch method call
				_nextSink.AsyncProcessRequest(sinkStack, requestMsg, requestHeaders, requestStream);
			}
			catch (Exception ex)
			{
				if (replySink != null)
				{
					// process exception synchronously
					replySink.SyncProcessMessage(new ReturnMessage(ex, methodCall));
				}
			}

			return null;
		}
		public IMessageCtrl AsyncProcessMessage (IMessage msg,
			IMessageSink replySink)
		{
			ITransportHeaders transportHeaders = new TransportHeaders();
			Stream stream = _nextInChain.GetRequestStream(msg, transportHeaders);
			if (stream == null) stream = new MemoryStream ();

			_binaryCore.Serializer.Serialize (stream, msg, null);
			if (stream is MemoryStream) stream.Position = 0;

			ClientChannelSinkStack stack = new ClientChannelSinkStack(replySink);
			stack.Push (this, msg);

			_nextInChain.AsyncProcessRequest (stack, msg, transportHeaders, stream);

			// FIXME: No idea about how to implement IMessageCtrl
			return null;	
		}
예제 #12
0
		public IMessageCtrl AsyncProcessMessage (IMessage msg,
							 IMessageSink replySink)
		{
			Stream requestStream;
			ITransportHeaders requestHeaders;
			SoapMessageFormatter soapMsgFormatter;
			
			SerializeMessage (msg, out requestStream, out requestHeaders,
				out soapMsgFormatter);

			ClientChannelSinkStack stack = new ClientChannelSinkStack (replySink);
			stack.Push(this, new CallData (msg, soapMsgFormatter));

			_nextChannelSink.AsyncProcessRequest (stack, msg, requestHeaders, requestStream);

			return null;
		}
예제 #13
0
 private void AsyncProcessMessageOnce(IMessage msg,
                                          Ior target, IMessageSink replySink) {
     IIorProfile selectedProfile;
     uint reqId;
     try {
         // allocate (reserve) connection
         GiopClientConnectionDesc conDesc = AllocateConnection(msg, target, out selectedProfile, out reqId);
         SimpleGiopMsg.SetMessageAsyncRequest(msg); // mark message as async, needed for portable interceptors
         ITransportHeaders requestHeaders;
         Stream requestStream;
         SerialiseRequest(msg, selectedProfile, conDesc, reqId,
                          out requestHeaders, out requestStream);
         // pass the serialised GIOP-request to the first stream handling sink
         // this sink is the last sink in the message handling sink chain, therefore the reply sink chain of all the previous message handling
         // sink is passed to the ClientChannelSinkStack, which will inform this chain of the received reply
         ClientChannelSinkStack clientSinkStack = new ClientChannelSinkStack(replySink);
         AsyncProcessingData asyncData = new AsyncProcessingData(msg, conDesc);
         clientSinkStack.Push(this, asyncData); // push the formatter onto the sink stack, to get the chance to handle the incoming reply stream
         // forward the message to the next sink
         m_nextSink.AsyncProcessRequest(clientSinkStack, msg, requestHeaders, requestStream);
         // for oneway messages, release the connections for future use
         if ((msg is IMethodCallMessage) && GiopMessageHandler.IsOneWayCall((IMethodCallMessage)msg)) {
              m_conManager.RequestOnConnectionCompleted(msg); // release the connection, because this interaction is complete
         }
     } catch {
         // release the connection, if something went wrong during connection allocation and send
         m_conManager.RequestOnConnectionCompleted(msg); // release the connection, because this interaction is complete
         throw;
     }
 }