/// <summary>
        /// Sends remote method invocation message to the remote application and gets result.
        /// This simplifies remove method invocation like calling a method locally.
        /// It throws Exception if any Exception occured on remote application's method.
        /// </summary>
        /// <param name="methodName">Method name to invoke</param>
        /// <param name="args">Method parameters</param>
        /// <returns>Return value of remote method</returns>
        protected object InvokeRemoteMethodAndGetResult(string methodName, params object[] args)
        {
            //Create MDSRemoteInvokeMessage object that contains invocation informations
            var invokeMessage = new MDSRemoteInvokeMessage {
                ServiceClassName = _serviceClassName, MethodName = methodName, Parameters = args
            };

            //Create MDS message to transmit MDSRemoteInvokeMessage.
            var outgoingMessage = _serviceConsumer.MdsClient.CreateMessage();

            outgoingMessage.DestinationServerName      = RemoteApplication.ServerName;
            outgoingMessage.DestinationApplicationName = RemoteApplication.ApplicationName;
            outgoingMessage.DestinationCommunicatorId  = RemoteApplication.CommunicatorId;
            outgoingMessage.TransmitRule = MessageTransmitRules.DirectlySend;
            outgoingMessage.MessageData  = GeneralHelper.SerializeObject(invokeMessage);

            //Send message and get response
            var incomingMessage = outgoingMessage.SendAndGetResponse(Timeout);

            incomingMessage.Acknowledge();

            //Deserialize and check return value
            var invokeReturnMessage = (MDSRemoteInvokeReturnMessage)GeneralHelper.DeserializeObject(incomingMessage.MessageData);

            if (invokeReturnMessage.RemoteException != null)
            {
                throw invokeReturnMessage.RemoteException;
            }

            //Success
            return(invokeReturnMessage.ReturnValue);
        }
        /// <summary>
        /// Sends remote method invocation message to the remote application and gets result.
        /// This simplifies remove method invocation like calling a method locally.
        /// It throws Exception if any Exception occured on remote application's method.
        /// </summary>
        /// <param name="methodName">Method name to invoke</param>
        /// <param name="args">Method parameters</param>
        /// <returns>Return value of remote method</returns>
        protected object InvokeRemoteMethodAndGetResult(string methodName, params object[] args)
        {
            //Create MDSRemoteInvokeMessage object that contains invocation informations
            var invokeMessage = new MDSRemoteInvokeMessage { ServiceClassName = _serviceClassName, MethodName = methodName, Parameters = args };

            //Create MDS message to transmit MDSRemoteInvokeMessage.
            var outgoingMessage = _serviceConsumer.MdsClient.CreateMessage();
            outgoingMessage.DestinationServerName = RemoteApplication.ServerName;
            outgoingMessage.DestinationApplicationName = RemoteApplication.ApplicationName;
            outgoingMessage.DestinationCommunicatorId = RemoteApplication.CommunicatorId;
            outgoingMessage.TransmitRule = MessageTransmitRules.DirectlySend;
            outgoingMessage.MessageData = GeneralHelper.SerializeObject(invokeMessage);

            //Send message and get response
            var incomingMessage = outgoingMessage.SendAndGetResponse(Timeout);
            incomingMessage.Acknowledge();

            //Deserialize and check return value
            var invokeReturnMessage = (MDSRemoteInvokeReturnMessage) GeneralHelper.DeserializeObject(incomingMessage.MessageData);
            if (invokeReturnMessage.RemoteException != null)
            {
                throw invokeReturnMessage.RemoteException;
            }

            //Success
            return invokeReturnMessage.ReturnValue;
        }