CgwMonitorManage.Tiandy.TiandyHttpClient.CallHttpInterface C# (CSharp) Method

CallHttpInterface() private method

调用天地伟业http接口
private CallHttpInterface ( string requestUrl ) : string
requestUrl string
return string
        private string CallHttpInterface(string requestUrl)
        {
            NLogEx.LoggerEx logEx = new NLogEx.LoggerEx(log);
            logEx.Trace("Enter: TiandyHttpClient.CallHttpInterface().");
            Stream stream = null;
            string result = null;
            try
            {
                //调用http接口
                WebClient webClient = new WebClient();

                stream = webClient.OpenRead(requestUrl);
                StreamReader streamReader = new StreamReader(stream);

                //调用HTTP接口返回json字符串
                result = streamReader.ReadToEnd();
            }
            catch (Exception e)
            {
                result = null;
                logEx.Error("Call http function failed.Exception message:{0}.", e.Message);
            }
            finally
            {
                //记录日志,待日志模块合入后补充日志信息
                if (stream != null)
                {
                    stream.Close();
                }
            }
            return result;
        }