webapi返回信息:
c#
//请求:
string url = "http://xxxxx/xxxx/xxx";
string strContent = "{'cmd':'xxxxx/xxxxxController/xxxxxxxxxx' ,'parameters':{'qrCode':'strQrCode','weight':'strWeight'}}";
//单引号换成双引号
strContent = strContent.Replace("\'", "\"").Replace("strQrCode", strQrCode).Replace("strWeight", strWeight);
//返回请求信息
string strResult = HttpRequestJson(url, strContent);
//取得返回字符串中的某字段(下图为创建的类,通过Json转换)
DataContractJsonSerializer serializer = new DataContractJsonSerializer(typeof(JsonGet));
var mStream = new MemoryStream(Encoding.UTF8.GetBytes(strResult.ToString()));
JsonGet json = (JsonGet)serializer.ReadObject(mStream);
if (json.statusCode == "200")
{
ResponseGet r = json.response;
if (r.status != "200")
{
MessageBox.Show(r.message);
return;
}
。。。。。。。。。。
}