loadrunner Web_类函数之web_switch_net_layer()

来源:互联网 发布:gta男性捏脸数据 编辑:程序博客网 时间:2024/05/21 17:04

web_switch_net_layer()

指定用于重放的网络层。(仅支持WAP类协议)

intweb_switch_net_layer(const char* NetName);

 

参数说明:

NetName:用于WAP重放的网络层:WSP,Sockets或WinInet。此参数不区分大小写。

一般信息 :

web_switch_net_layer函数允许您在网络层之间切换以进行重放。它允许您在同一脚本中混合直接HTTP和WSP调用。目前,该函数仅影响WAP Vuser。

对于以HTTP模式或无线会话协议(WSP)重放模式运行的WAP脚本,支持此功能。

对于Web Vuser,默认值是运行时设置(Internet协议:首选项节点)中的值。运行时设置默认为套接字。使用运行时设置,可以切换到WinInet。但是,这些设置适用于整个脚本。使用此功能,可以在执行期间切换行为。

对于WAP Vuser - 如果指定了网关,则默认为WSP。否则,它使用运行时设置,如Web Vuser。

 

示例:web_switch_net_layer

在以下示例中,Vuser执行相同的操作两次,一次使用Sockets,下一次使用WSP。web_switch_net_layer函数将原始网络层设置为Sockets,然后设置为WSP。

#include“as_web.h”

#include“as_wap.h”

Action1()

{

//web_switch_net_layer(“net =WinInet”);

web_switch_net_layer(“sockets”);

web_add_auto_header(“Accept”,

“application / x-hdmlc,application /x-up-alert,application / x-up-cacheop,application / x-up-device,application /x-up-digestentry,application / vnd.wap.wml,text / x -wap.wml,text / vnd.wap.wml,application / vnd.wap.wmlscript,text /vnd.wap.wmlscript,application / vnd.uplanet.channel,application / vnd.uplanet.list,text / x-hdml,text / x-hdml; version = 3.1,text/ x-hdml; version = 3.0,text / x-hdml; version = 2.0,image / bmp,text / html,text / xml“);

 

web_add_auto_header(“Accept-Charset”,“ISO-8859-1,UTF-8,*”);

。 。。

web_url(“index.wml”,

     “URL = http://developer.openwave.com/dev/sdk.41/wml/index.wml”,

     “Resource = 0”,

     “RecContentType = text / vnd.wap.wml”,

     “Referer =”,

     “Mode = HTTP”,

     LAST);

web_url(“currency.wml”,

“URL = http://developer.openwave.com/dev/sdk.41/wmls/currency/currency.wml”,

     “Resource = 0”,

      “RecContentType = text / vnd.wap.wml”,

     “Referer =”,

     “Mode = HTTP”,

     LAST);

 

web_url(“converter.wmls”,

“URL = http://developer.openwave.com/dev/sdk.41/wmls/currency/converter.wmls”,

     “Resource = 0”,

     “RecContentType = text / vnd.wap.wmlscript”,

     “Referer =”,

     “Mode = HTTP”,

     LAST);

 

web_switch_net_layer(“WSP”);

wap_connect();

web_add_auto_header(“Accept”,

 

“application / x-hdmlc,application /x-up-alert,application / x-up-cacheop,application / x-up-device,application /x-up-digestentry,application / vnd.wap.wml,text / x -wap.wml,text / vnd.wap.wml,application / vnd.wap.wmlscript,text /vnd.wap.wmlscript,application / vnd.uplanet.channel,application / vnd.uplanet.list,text / x-hdml,text / x-hdml; version = 3.1,text/ x-hdml; version = 3.0,text / x-hdml; version = 2.0,image / bmp,text / html,text / xml“);

 

web_add_auto_header(“Accept-Charset”,“ISO-8859-1,UTF-8,*”);

web_add_auto_header(

    “Content-Type”,“application/ x-www-form-urlencoded”);

web_url(“index.wml”,

     “URL = http://developer.openwave.com/dev/sdk.41/wml/index.wml”,

     “Resource = 0”,

     “RecContentType = text / vnd.wap.wml”,

     “Referer =”,

     “Mode = HTTP”,

     LAST);

 

web_url(“currency.wml”,

“URL = http://developer.openwave.com/dev/sdk.41/wmls/currency/currency.wml”,

     “Resource = 0”,

     “RecContentType = text / vnd.wap.wml”,

     “Referer =”,

     “Mode = HTTP”,

     LAST);

 

web_url(“converter.wmls”,

“URL = http://developer.openwave.com/dev/sdk.41/wmls/currency/converter.wmls”,

     “Resource = 0”,

     “RecContentType = text / vnd.wap.wmlscript”,

     “Referer =”,

     “Mode = HTTP”,

     LAST);

wap_disconnect();

return0;

}}