public void getRep() { RequestHead head = new RequestHead(); head.appKey = "lilang"; head.askSerialNo = Guid.NewGuid().ToString(); head.method = "APIgetreportsLilang"; head.secretKey = "96B94FF9-EC8A-4E73-8394-B97029C72DC8"; head.sendTime = System.DateTime.Now.ToString("yyyyMMddHHmmss"); RequestBody2 body = new RequestBody2(); body.reportNO = "cttt-qz17006793"; // 请求对象 RequestData RequestBean = new RequestData(); RequestBean.head = head; RequestBean.body = body; // 返回对象 ReportsListResponseStructBean ResponseBean = new ReportsListResponseStructBean(); // 请求功能URL string url; url = "http://data.cnttts.com:58080/dmz/v1/M0001"; string postJson = JsonConvert.SerializeObject(RequestBean, Newtonsoft.Json.Formatting.None); // 请求后台 string retmp = PostFunction(url, postJson); ResponseBean = JsonConvert.DeserializeObject <ReportsListResponseStructBean>(retmp); }
protected void Button1_Click(object sender, EventArgs e) { getRep(); return; RequestHead head = new RequestHead(); head.appKey = "lilang"; head.askSerialNo = Guid.NewGuid().ToString(); head.method = "APIgetreportsLilang"; head.secretKey = "96B94FF9-EC8A-4E73-8394-B97029C72DC8"; head.sendTime = System.DateTime.Now.ToString("yyyyMMddHHmmss"); RequestBody body = new RequestBody(); body.s01 = "009393"; // 请求对象 RequestData RequestBean = new RequestData(); RequestBean.head = head; //RequestBean.body = body; // 返回对象 ReportsListResponseStructBean ResponseBean = new ReportsListResponseStructBean(); // 请求功能URL string url = "http://data.cnttts.com:58080/dmz/v1/M0001"; url = "http://data.cnttts.com:58080/dmz/v1/T0001"; string postJson = JsonConvert.SerializeObject(RequestBean, Newtonsoft.Json.Formatting.None); // 请求后台 string retmp = PostFunction(url, postJson); ResponseBean = JsonConvert.DeserializeObject <ReportsListResponseStructBean>(retmp); }