public override string PostRequest(string body) { string result = ""; try { Dictionary <string, string> header = new Dictionary <string, string>(); // header.Add("Content-Type", "application/x-www-form-urlencoded"); header.Add("Authorization", "Basic c21zc2VydmVyLWFwaTpiYTVjOTYzNjkxYjM5ZjlkZWQwZDI2OGZkMWI5ZTNkYjgyYTI1M2RlZmMx"); string hresult = GlobalWebRequestHelper.HttpPostRequestWithHeader(this.Cur_Job.tokenweburl, "", "json", "x-www-form-urlencoded", header); Log4netUtil.Info("作业【" + this.Cur_Job.name + "】获取token值:" + hresult); HaToken token = JsonConvert.DeserializeObject <HaToken>(hresult); if (token != null && !string.IsNullOrEmpty(token.access_token)) { header.Clear(); //header.Add("Content-Type", "application/json"); header.Add("Authorization", token.token_type + " " + token.access_token); result = GlobalWebRequestHelper.HttpPostRequestWithHeader(this.Cur_Job.weburl, body, "json", "json", header); } } catch (Exception ex) { Log4netUtil.Error("作业【" + this.Cur_Job.name + "】PostRequest推送异常:" + ex.Message + "|参数:" + body, ex); } return(result); }
public virtual string PostRequest(string body) { string result = ""; try { result = GlobalWebRequestHelper.HttpPostRequest(this.Cur_Job.weburl, body); } catch (Exception ex) { Log4netUtil.Error("作业【" + this.Cur_Job.name + "】PostRequest推送异常:" + ex.Message + "|参数:" + body, ex); } return(result); }
public override string WebRequest() { string result = ""; try { result = this.Cur_Job.servermethod.ToLower() == "get" ? GlobalWebRequestHelper.HttpGetRequest(this.Cur_Job.weburl, this.Cur_Job.GetExcuteCondition()) : GlobalWebRequestHelper.HttpPostRequest(this.Cur_Job.weburl, this.Cur_Job.GetExcuteCondition()); } catch (Exception ex) { Log4netUtil.Error("作业【" + this.Cur_Job.name + "】执行WebRequest异常:" + ex.Message, ex); result = ""; } return(result); }
public override string WebRequest() { string result = ""; try { result = GlobalWebRequestHelper.RestRequest(this.Cur_Job.weburl, this.Cur_Job.servermethod, this.Cur_Job.GetExcuteCondition(), this.Cur_Job.node); } catch (Exception ex) { Log4netUtil.Error("作业【" + this.Cur_Job.name + "】RunInterfaceByRest执行异常:" + ex.Message, ex); result = ""; } return(result); }
public override string WebRequest() { string result = ""; try { WebServiceArgs list = JsonConvert.DeserializeObject <WebServiceArgs>(this.Cur_Job.GetExcuteCondition()); object[] args = null; if (list != null && list.ArgsList != null && list.ArgsList.Count > 0) { args = new object[list.ArgsList.Count]; foreach (WebServiceArgsInfo item in list.ArgsList) { args.SetValue(item.Value, item.KeyIndex); } } result = GlobalWebRequestHelper.SoapRequest(this.Cur_Job.weburl, this.Cur_Job.servermethod, args); } catch (Exception ex) { Log4netUtil.Error("作业【" + this.Cur_Job.name + "】RunInterfaceByWebService执行异常:" + ex.Message, ex); } return(result); }