Performance tests for encapsulating data in HTTP using JSON A project uses JSON to encapsulate data, interfaces such as: client send: post/list.do http/1.1 host:zoomi.com.cn connection:close Accept: */ * cookie:sessionid=ea277024eceb83494a0c490981f57d57 content-length:100 {"Action": "Get", "target": "Broadcast_thread_list", "type": "All"} the server returns: http/1.1 ok content-length:100 {"Action": "Get", "target": "Broadcast_thread_list", " Result ":0, " type ":" All ", " content ": [, 1001, 1002 ...] //Post ID list, The post ID is int type } script as follows action () { web_add_header ("Host", "zoomi.com.cn"); web_add_header ("Connection", "close"), //web_add_header ("Accept", "*/*"); // Web_add_header ("Cookie", "sessionid=ea277024eceb83494a0c490981f57d57"); //cookie has not yet implemented //web_add_header ("Content-length", "100"); //If you add this script, the reason is not known web_add_header ("X-uid", "three"); Web_custom_request ("broadcast", //write a name "Method=post", // "resource=1", //Request method, this thing does not also can, is not the resources do not need it &NBS P "Url=http://10.60.30.27:8080/childrearing/list.do", //request address // "url=http:// 10.60.30.28:80/list.do ", " Reccontenttype=application/json ", //specifies the content-type of the response header, This is json "Enctype=application/json", //Specify the Content-type of the request header, Here is also json // "mode=html", "body={" action ":" Get "," target ":" Broadcast_thread_list "," type ":" All "}", // "targetframe=", // raw_body_start, &NB Sp //request body start identifier // "{" Action ":" Get "," target ":" Broadcast_thread_list "," type ":" All "}", // 78, &NBSp //The length of the body content in the above line // raw_body_end, //request BODY end identifier last);   ;//Explain, in fact, the JSON data in the BODY, or use the Raw_body_start function can be. Here is a convenient figure for the body. Note, however, that you want to escape the double quotation mark with a backslash, which is shown in Vugen as a ¥return 0;}
Performance test for encapsulating data using JSON in HTTP