Exemple #1
0
        /// <summary>
        /// Sends return value to the remote application that invoked a service method.
        /// </summary>
        /// <param name="incomingMessage">Incoming invoke message from remote application</param>
        /// <param name="returnValue">Return value to send</param>
        private static void SendReturnValue(IIncomingMessage incomingMessage, object returnValue)
        {
            if (incomingMessage.TransmitRule != MessageTransmitRules.DirectlySend)
            {
                return;
            }

            try
            {
                //Create return message
                var returnMessage = new NGRIDRemoteInvokeReturnMessage {
                    ReturnValue = returnValue
                };
                //Create response message and send
                var responseMessage = incomingMessage.CreateResponseMessage();
                responseMessage.MessageData = GeneralHelper.SerializeObject(returnMessage);
                responseMessage.Send();
            }
            catch (Exception ex)
            {
                Logger.Error(ex.Message, ex);
            }
        }
        /// <summary>
        /// Sends return value to the remote application that invoked a service method.
        /// </summary>
        /// <param name="incomingMessage">Incoming invoke message from remote application</param>
        /// <param name="returnValue">Return value to send</param>
        private static void SendReturnValue(IIncomingMessage incomingMessage, object returnValue)
        {
            if (incomingMessage.TransmitRule != MessageTransmitRules.DirectlySend)
            {
                return;
            }

            try
            {
                //Create return message
                var returnMessage = new NGRIDRemoteInvokeReturnMessage { ReturnValue = returnValue };
                //Create response message and send
                var responseMessage = incomingMessage.CreateResponseMessage();
                responseMessage.MessageData = GeneralHelper.SerializeObject(returnMessage);
                responseMessage.Send();
            }
            catch (Exception ex)
            {
                Logger.Error(ex.Message, ex);
            }
        }