protected void Button1_Click(object sender, EventArgs e) { List <valReq> listreq = new List <valReq>(); valReq curreq = new valReq(); curreq.id = 5; curreq.type = 0; listreq.Add(curreq); valReq curreq2 = new valReq(); curreq2.id = 4; curreq2.type = 0; listreq.Add(curreq2); string Str = JsonConvert.SerializeObject(listreq); String url = "http://192.168.48.232:1111/OpcService/getval"; List <valRes> listres = WebOper.HttpPost(url, Str, typeof(List <valRes>)) as List <valRes>; Label1.Text = listres[0].id + "-" + listres[0].val; }
public List <valRes> GetOpcVal(List <valReq> listreq) { //List<valReq> listQes //List<valReq> listreq = new List<valReq>(); //valReq curreq = new valReq(); //curreq.id = 5; //curreq.type = 0; //listreq.Add(curreq); //valReq curreq2 = new valReq(); //curreq2.id = 4; //curreq2.type = 0; //listreq.Add(curreq2); string Str = JsonConvert.SerializeObject(listreq); String url = "http://192.168.48.232:1111/OpcService/getval"; List <valRes> ja2 = WebOper.HttpPost(url, Str, typeof(List <valRes>)) as List <valRes>; return(ja2); //return "Hello World"; }