ysh0033 发表于 2010-10-28 14:43:17

LOadRunner中发送post消息,遇到困难求助!

POST /requesttransaction HTTP/1.1
Accept: image/gif,image/x-xbitmap
Host: 10.71.113.170:8080
Content-Length:129
Content-Type: application/x-www-form-urlencoded
Cache-Control: no-cache
Accept-Encoding: gzip,deflate

TransType=5&UserType=1&SrcMdn=13699999999&ContID=0100100900&ContTitle=wzh0330&SubMsg=&DevMdns=13612222123&TimeOut=-1&BeginTime=-1


知道用 web_custon_request函数,但具体格式不太明白了。
望高手帮忙解答 谢谢!

skyzhu 发表于 2010-10-28 15:07:04

web_submit_data("requesttransaction",
                "Action=http://test.test.com/requesttransaction",
                "Method=POST",
                "RecContentType=text/html",
                "Mode=HTTP",
                ITEMDATA,
                "Name=TransType", "Value=5", ENDITEM,
                "Name=UserType", "Value=1", ENDITEM,
                "Name=SrcMdn", "Value=13699999999", ENDITEM,
                剩下自己写
                LAST);


另外个

web_add_header("Content-Type", "application/x-www-form-urlencoded");

web_custom_request("requesttransaction ", "Method=POST",
       "URL=http://test.test.com/requesttransaction ",
       "Body=TransType=5&UserType=1&SrcMdn=13699999999&ContID=0100100900&ContTitle=wzh0330&SubMsg=&DevMdns=13612222123&TimeOut=-1&BeginTime=-1",
       LAST);

PrefTest 发表于 2010-10-28 16:15:52

LoadRunner帮助文档中有详细的函数格式和使用方法,还有例子,摘录如下:
web_add_header("Content–Type",

"multipart/form–data; boundary=–––––––––––––––––––––––––––292742461228954");

web_custom_request("post_query.exe", "Method=POST",

    "URL=http://lazarus/cgi–bin/post_query.exe",

    "Body=–––––––––––––––––––––––––––––292742461228954\r\nContent–Disp"

    "osition: form–data; name=\"entry\"\r\n\r\nText\r\n––––––––––"

    "–––––––––––––––––––292742461228954\r\nContent–Disposition: f"

    "–––––––––––292742461228954––\r\n",

    "TargetFrame=",

    LAST );

配合HttpWatch等截包工具使用效果尤佳!
页: [1]
查看完整版本: LOadRunner中发送post消息,遇到困难求助!