Ejemplo n.º 1
0
 public static void RequestAsy <TRequest>(RequestModel <TRequest> request)
 {
     try
     {
         HttpSOAClient client = new HttpSOAClient();
         RequestInfo   model  = client.GetList().Find(a => a.RequestType == request.Header.RequestType);
         if (model != null)
         {
             string requestStr = string.Empty;
             if (request.Body != null)
             {
                 if (request.Body.GetType().IsClass&& request.Body.GetType() != typeof(string))
                 {
                     requestStr = JsonConvert.SerializeObject(request.Body);
                 }
                 else
                 {
                     requestStr = request.Body.ToString();
                 }
             }
             if (requestStr.Length <= UInt16.MaxValue)
             {
                 LogManager.CreateTpoLog().Info(request.Header.RequestType, requestStr);
             }
             client.RequsetAsy(model.RequestType, requestStr, model.RequestUrl, model.TimeOut);
         }
     }
     catch (Exception ex)
     {
         LogManager.CreateTpoLog().Error(request.Header.RequestType, ex);
     }
 }
Ejemplo n.º 2
0
        /// <summary>
        /// 得到访问对象
        /// </summary>
        public static RequestInfo GetDefaultList(string requestType)
        {
            HttpSOAClient client = new HttpSOAClient();

            var data = client.GetList();

            var model = data.Find(a => a.RequestType.Trim() == requestType.Trim());

            if (model == null)
            {
                Esmart.Framework.Logging.LogManager.CreateTpoLog().Info(requestType, JsonConvert.SerializeObject(data));//日记记录
            }

            return(model);
        }