/// <summary> /// 提交put请求,并返回json结果 /// </summary> /// <param name="url">提交eSight的url</param> /// <param name="jsonObject">提交的json对象</param> /// <param name="isOpenAgain">重新打开连接</param> /// <param name="isPrint">是否打印</param> /// <returns>返回JObject的eSight返回结果</returns> public JObject HCPut(string url, object jsonObject, bool isOpenAgain, bool isPrint) { if (isOpenAgain) { Open(); } string abUrl = GetFullURL(url); //abUrl=eSight_Url+业务url InitHCHead(); //初始化openId. JObject retObj = null; try { for (int i = 0; i <= 1; i++) { var content = new StringContent(JsonUtil.SerializeObject(jsonObject), Encoding.UTF8, "application/json"); LogUtil.HWLogger.API.DebugFormat("Send json by put[{0}]:{1}", abUrl, isPrint ? GetPrintInfoOfJson(jsonObject) : "******"); HttpResponseMessage hrm = HClient.PutAsync(abUrl, content).Result; retObj = HCCheckResult(abUrl, hrm); if (!string.Equals(GetJObjectPropVal <string>(retObj, "code"), Const.ConstMgr.ErrorCode.HW_LOGIN_AUTH)) { break; } else { if (isOpenAgain) { LogUtil.HWLogger.API.WarnFormat("Login agin,Retry.."); TryOpen(); } else { break; } } } } catch (System.AggregateException ae) { HandleException(ae); } return(retObj); }