コード例 #1
0
        /// <summary>
        /// 以同步的方式(阻塞),获取服务执行的结果消息
        /// </summary>
        /// <typeparam name="T">消息类型</typeparam>
        /// <param name="reqSrvUrl">服务地址</param>
        /// <param name="resultDataType">消息的数据类型</param>
        /// <returns>消息转换器对象,如果不成功,返回空值</returns>
        public MessageConverter <T> GetServiceMessage <T>(string reqSrvUrl, DataType resultDataType)
        {
            CheckConnect();
            //ServiceSubscriber.SendMessage(reqSrvUrl);

            string remoteMsg = ServiceSubscriber.RequestMessage(reqSrvUrl);
            string errMsg    = ServiceConst.GetServiceErrorMessage(remoteMsg);

            if (errMsg != string.Empty)
            {
                RaiseSubscriberError(this, new MessageEventArgs(errMsg));
                return(null);
            }
            else
            {
                MessageConverter <T> convert = new MessageConverter <T>(remoteMsg, resultDataType);
                return(convert);
            }
        }
コード例 #2
0
        public string RequestMessage(string sendMessage)
        {
            string remoteMsg = ServiceSubscriber.RequestMessage(sendMessage);

            return(remoteMsg);
        }