关于使用LoadRunner测试时使用Servlet返回的Sessionid的问题

311 篇文章 0 订阅
213 篇文章 0 订阅
Action()
{
	web_url("dianhua.html", 
		"URL=http://90.0.12.120:8080/YGBXWebGIS/dianhua.html", 
		"Resource=0", 
		"RecContentType=text/html", 
		"Referer=", 
		"Snapshot=t1.inf", 
		"Mode=HTML", 
		EXTRARES, 
		"Url=../favicon.ico", "Referer=", ENDITEM, 
		LAST);
	//注册变量,这个处理过程要放在返回结果之前,表示从返回结果截取需要的字符串
	web_reg_save_param("sessionid","LB=JSESSIONID=","RB=;","Search=all",LAST);
	//提交数据,要取得返回的结果中的某个参数,必须在提交之前注册
	web_submit_data("TextPhoneServlet", 
		"Action=http://90.0.12.120:8080/YGBXWebGIS/TextPhoneServlet", 
		"Method=POST", 
		"RecContentType=application/x-json", 
		"Referer=http://90.0.12.120:8080/YGBXWebGIS/dianhua.html", 
		"Snapshot=t2.inf", 
		"Mode=HTML", 
		ITEMDATA, 
		"Name=type", "Value=paraToGPS", ENDITEM, 
		"Name=province", "Value=", ENDITEM, 
		"Name=city", "Value=", ENDITEM, 
		"Name=district", "Value=", ENDITEM, 
		"Name=agencyCode", "Value=01520000", ENDITEM, 
		"Name=policyno", "Value=1375105082011000113", ENDITEM, 
		"Name=accidentno", "Value=C375105082011903085", ENDITEM, 
		"Name=insured", "Value=", ENDITEM, 
		"Name=insuredid", "Value=11111111111111", ENDITEM, 
		"Name=insurednumberplates", "Value=", ENDITEM, 
		"Name=frameno", "Value=9043829048", ENDITEM, 
		"Name=engineno", "Value=09849023423432", ENDITEM, 
		"Name=surveysites", "Value=", ENDITEM, 
		"Name=isSecondDspatcher", "Value=true", ENDITEM, 
		"Name=lon", "Value=120.46344", ENDITEM, 
		"Name=lat", "Value=41.58501", ENDITEM, 
		"Name=zoomlevel", "Value=9", ENDITEM, 
		LAST);

	//输出变量
	lr_output_message("SessionId=%s",lr_eval_string("{sessionid}"));
	//使用变量
	web_url("LoginPhoneDispatcherServlet", 
		"URL=http://90.0.12.120:8080/YGBXWebGIS/LoginPhoneDispatcherServlet?username=wc&password=1&delsession=no&sessionid={sessionid}", 
		"Resource=0", 
		"RecContentType=text/html", 
		"Referer=", 
		"Snapshot=t3.inf", 
		"Mode=HTML", 
		EXTRARES, 
		"Url=ext-3.4.0/resources/images/default/qtip/tip-sprite.gif", "Referer=http://90.0.12.120:8080/YGBXWebGIS/phoneDispatcher.html", ENDITEM, 
		"Url=ext-3.4.0/resources/images/default/qtip/tip-anchor-sprite.gif", "Referer=http://90.0.12.120:8080/YGBXWebGIS/phoneDispatcher.html", ENDITEM, 
		"Url=ext-3.4.0/resources/images/default/layout/mini-right.gif", "Referer=http://90.0.12.120:8080/YGBXWebGIS/phoneDispatcher.html", ENDITEM, 
		"Url=ext-3.4.0/resources/images/default/layout/mini-left.gif", "Referer=http://90.0.12.120:8080/YGBXWebGIS/phoneDispatcher.html", ENDITEM, 
		"Url=ext-3.4.0/resources/images/default/button/btn.gif", "Referer=http://90.0.12.120:8080/YGBXWebGIS/phoneDispatcher.html", ENDITEM, 
		"Url=img/zoomout.png", "Referer=http://90.0.12.120:8080/YGBXWebGIS/phoneDispatcher.html", ENDITEM, 
		"Url=img/zoomin.png", "Referer=http://90.0.12.120:8080/YGBXWebGIS/phoneDispatcher.html", ENDITEM, 
		"Url=img/pan.png", "Referer=http://90.0.12.120:8080/YGBXWebGIS/phoneDispatcher.html", ENDITEM, 
		"Url=img/biaochi.png", "Referer=http://90.0.12.120:8080/YGBXWebGIS/phoneDispatcher.html", ENDITEM, 
		"Url=img/center.png", "Referer=http://90.0.12.120:8080/YGBXWebGIS/phoneDispatcher.html", ENDITEM, 
		"Url=img/fb.png", "Referer=http://90.0.12.120:8080/YGBXWebGIS/phoneDispatcher.html", ENDITEM, 
		"Url=img/clear.png", "Referer=http://90.0.12.120:8080/YGBXWebGIS/phoneDispatcher.html", ENDITEM, 
		"Url=img/rectsearch.png", "Referer=http://90.0.12.120:8080/YGBXWebGIS/phoneDispatcher.html", ENDITEM, 
		"Url=img/daohang1.png", "Referer=http://90.0.12.120:8080/YGBXWebGIS/phoneDispatcher.html", ENDITEM, 
		"Url=img/printmap.gif", "Referer=http://90.0.12.120:8080/YGBXWebGIS/phoneDispatcher.html", ENDITEM, 
		"Url=ext-3.4.0/resources/images/default/form/text-bg.gif", "Referer=http://90.0.12.120:8080/YGBXWebGIS/phoneDispatcher.html", ENDITEM, 
		"Url=img/application_form_magnify.png", "Referer=http://90.0.12.120:8080/YGBXWebGIS/phoneDispatcher.html", ENDITEM, 
		"Url=img/lock.png", "Referer=http://90.0.12.120:8080/YGBXWebGIS/phoneDispatcher.html", ENDITEM, 
		"Url=images/changemap2.png", "Referer=http://90.0.12.120:8080/YGBXWebGIS/phoneDispatcher.html", ENDITEM, 
		"Url=images/tushi.png", "Referer=http://90.0.12.120:8080/YGBXWebGIS/phoneDispatcher.html", ENDITEM, 
		"Url=ext-3.4.0/resources/images/default/toolbar/bg.gif", "Referer=http://90.0.12.120:8080/YGBXWebGIS/phoneDispatcher.html", ENDITEM, 
		"Url=ext-3.4.0/resources/images/default/s.gif", "Referer=http://90.0.12.120:8080/YGBXWebGIS/phoneDispatcher.html", ENDITEM, 
		"Url=ext-3.4.0/resources/images/default/grid/grid3-hrow.gif", "Referer=http://90.0.12.120:8080/YGBXWebGIS/phoneDispatcher.html", ENDITEM, 
		"Url=ext-3.4.0/resources/images/default/dd/drop-no.gif", "Referer=http://90.0.12.120:8080/YGBXWebGIS/phoneDispatcher.html", ENDITEM, 
		"Url=ext-3.4.0/resources/images/default/grid/col-move-top.gif", "Referer=http://90.0.12.120:8080/YGBXWebGIS/phoneDispatcher.html", ENDITEM, 
		"Url=ext-3.4.0/resources/images/default/grid/col-move-bottom.gif", "Referer=http://90.0.12.120:8080/YGBXWebGIS/phoneDispatcher.html", ENDITEM, 
		"Url=images/table_16x16.gif", "Referer=http://90.0.12.120:8080/YGBXWebGIS/phoneDispatcher.html", ENDITEM, 
		"Url=images/notepad_16x16.gif", "Referer=http://90.0.12.120:8080/YGBXWebGIS/phoneDispatcher.html", ENDITEM, 
		"Url=ext-3.4.0/resources/images/default/layout/mini-top.gif", "Referer=http://90.0.12.120:8080/YGBXWebGIS/phoneDispatcher.html", ENDITEM, 
		"Url=ext-3.4.0/resources/images/default/tabs/tab-strip-bg.gif", "Referer=http://90.0.12.120:8080/YGBXWebGIS/phoneDispatcher.html", ENDITEM, 
		"Url=ext-3.4.0/resources/images/default/tabs/tabs-sprite.gif", "Referer=http://90.0.12.120:8080/YGBXWebGIS/phoneDispatcher.html", ENDITEM, 
		"Url=http://img.mapbar.com/maplite/images/mapbar31.2.1.png", "Referer=http://90.0.12.120:8080/YGBXWebGIS/phoneDispatcher.html", ENDITEM, 
		"Url=http://img.mapbar.com/maplite/images/mask.gif", "Referer=http://90.0.12.120:8080/YGBXWebGIS/phoneDispatcher.html", ENDITEM, 
		"Url=http://img3.mapbar.com/maplite/mapbank/mapbar/8/120_51/3_9.png", "Referer=http://90.0.12.120:8080/YGBXWebGIS/phoneDispatcher.html", ENDITEM, 
		"Url=http://img.mapbar.com/maplite/mapbank/mapbar/8/120_51/4_8.png", "Referer=http://90.0.12.120:8080/YGBXWebGIS/phoneDispatcher.html", ENDITEM, 
		"Url=http://img.mapbar.com/maplite/mapbank/mapbar/8/120_52/4_0.png", "Referer=http://90.0.12.120:8080/YGBXWebGIS/phoneDispatcher.html", ENDITEM, 
		"Url=http://img3.mapbar.com/maplite/mapbank/mapbar/8/120_51/5_9.png", "Referer=http://90.0.12.120:8080/YGBXWebGIS/phoneDispatcher.html", ENDITEM, 
		"Url=http://img2.mapbar.com/maplite/mapbank/mapbar/8/120_51/5_8.png", "Referer=http://90.0.12.120:8080/YGBXWebGIS/phoneDispatcher.html", ENDITEM, 
		"Url=images/control/switch_2_1.png", "Referer=http://90.0.12.120:8080/YGBXWebGIS/phoneDispatcher.html", ENDITEM, 
		"Url=images/control/switch_1_2.png", "Referer=http://90.0.12.120:8080/YGBXWebGIS/phoneDispatcher.html", ENDITEM, 
		"Url=images/control/status.jpg", "Referer=http://90.0.12.120:8080/YGBXWebGIS/phoneDispatcher.html", ENDITEM, 
		"Url=http://img.mapbar.com/maplite/mapbank/mapbar/4/5_2/9_5.png", "Referer=http://90.0.12.120:8080/YGBXWebGIS/phoneDispatcher.html", ENDITEM, 
		"Url=http://img.mapbar.com/maplite/mapbank/mapbar/4/5_2/9_6.png", "Referer=http://90.0.12.120:8080/YGBXWebGIS/phoneDispatcher.html", ENDITEM, 
		"Url=http://img.mapbar.com/maplite/mapbank/mapbar/4/6_2/0_5.png", "Referer=http://90.0.12.120:8080/YGBXWebGIS/phoneDispatcher.html", ENDITEM, 
		"Url=images/map/check.png", "Referer=http://90.0.12.120:8080/YGBXWebGIS/phoneDispatcher.html", ENDITEM, 
		"Url=images/icons/redstar1.gif", "Referer=http://90.0.12.120:8080/YGBXWebGIS/phoneDispatcher.html", ENDITEM, 
		"Url=ext-3.4.0/resources/images/default/tree/loading.gif", "Referer=http://90.0.12.120:8080/YGBXWebGIS/phoneDispatcher.html", ENDITEM, 
		"Url=http://img.mapbar.com/maplite/mapbank/mapbar/4/6_2/0_6.png", "Referer=http://90.0.12.120:8080/YGBXWebGIS/phoneDispatcher.html", ENDITEM, 
		"Url=ext-3.4.0/resources/images/default/tree/arrows.gif", "Referer=http://90.0.12.120:8080/YGBXWebGIS/phoneDispatcher.html", ENDITEM, 
		"Url=http://img2.mapbar.com/maplite/mapbank/mapbar/8/120_52/3_0.png", "Referer=http://90.0.12.120:8080/YGBXWebGIS/phoneDispatcher.html", ENDITEM, 
		"Url=http://img1.mapbar.com/maplite/mapbank/mapbar/8/120_51/4_9.png", "Referer=http://90.0.12.120:8080/YGBXWebGIS/phoneDispatcher.html", ENDITEM, 
		"Url=http://img2.mapbar.com/maplite/mapbank/mapbar/8/120_52/5_0.png", "Referer=http://90.0.12.120:8080/YGBXWebGIS/phoneDispatcher.html", ENDITEM, 
		"Url=ext-3.4.0/resources/images/default/window/right-corners.png", "Referer=http://90.0.12.120:8080/YGBXWebGIS/phoneDispatcher.html", ENDITEM, 
		"Url=ext-3.4.0/resources/images/default/window/left-right.png", "Referer=http://90.0.12.120:8080/YGBXWebGIS/phoneDispatcher.html", ENDITEM, 
		"Url=ext-3.4.0/resources/images/default/window/left-corners.png", "Referer=http://90.0.12.120:8080/YGBXWebGIS/phoneDispatcher.html", ENDITEM, 
		"Url=ext-3.4.0/resources/images/default/panel/tool-sprites.gif", "Referer=http://90.0.12.120:8080/YGBXWebGIS/phoneDispatcher.html", ENDITEM, 
		"Url=ext-3.4.0/resources/images/default/window/top-bottom.png", "Referer=http://90.0.12.120:8080/YGBXWebGIS/phoneDispatcher.html", ENDITEM, 
		"Url=img/huitian1.png", "Referer=http://90.0.12.120:8080/YGBXWebGIS/phoneDispatcher.html", ENDITEM, 
		"Url=http://img2.mapbar.com/maplite/mapbank/mapbar/8/120_51/3_8.png", "Referer=http://90.0.12.120:8080/YGBXWebGIS/phoneDispatcher.html", ENDITEM, 
		LAST);

	web_submit_data("UserRolesServlet", 
		"Action=http://90.0.12.120:8080/YGBXWebGIS/servlet/UserRolesServlet", 
		"Method=POST", 
		"RecContentType=application/x-json", 
		"Referer=http://90.0.12.120:8080/YGBXWebGIS/phoneDispatcher.html", 
		"Snapshot=t4.inf", 
		"Mode=HTML", 
		ITEMDATA, 
		"Name=type", "Value=getMenus", ENDITEM, 
		"Name=id", "Value=-2", ENDITEM, 
		LAST);

	web_submit_data("AdministrativeSevlert", 
		"Action=http://90.0.12.120:8080/YGBXWebGIS/servlet/AdministrativeSevlert", 
		"Method=POST", 
		"RecContentType=application/x-json", 
		"Referer=http://90.0.12.120:8080/YGBXWebGIS/phoneDispatcher.html", 
		"Snapshot=t5.inf", 
		"Mode=HTML", 
		ITEMDATA, 
		"Name=type", "Value=getCityInfoTree", ENDITEM, 
		"Name=node", "Value=-1", ENDITEM, 
		LAST);

	web_submit_data("PhoneDispatcherServlet", 
		"Action=http://90.0.12.120:8080/YGBXWebGIS/PhoneDispatcherServlet", 
		"Method=POST", 
		"RecContentType=text/html", 
		"Referer=http://90.0.12.120:8080/YGBXWebGIS/phoneDispatcher.html", 
		"Snapshot=t6.inf", 
		"Mode=HTML", 
		ITEMDATA, 
		"Name=type", "Value=getParasePara", ENDITEM, 
		LAST);

	web_url("mv.mapbar.com", 
		"URL=http://mv.mapbar.com/?120.46259,41.58264@9@kt04rfe*www.mapbar.com@LW@FU@3@2@8890@mapbar@1@base@mapbaruux", 
		"Resource=0", 
		"RecContentType=text/html", 
		"Referer=http://90.0.12.120:8080/YGBXWebGIS/phoneDispatcher.html", 
		"Mode=HTML", 
		LAST);

	web_submit_data("PhoneDispatcherServlet_2", 
		"Action=http://90.0.12.120:8080/YGBXWebGIS/PhoneDispatcherServlet", 
		"Method=POST", 
		"RecContentType=text/html", 
		"Referer=http://90.0.12.120:8080/YGBXWebGIS/phoneDispatcher.html", 
		"Snapshot=t7.inf", 
		"Mode=HTML", 
		ITEMDATA, 
		"Name=type", "Value=getxingzhengid", ENDITEM, 
		"Name=strLonLat", "Value=120.46344,41.58501", ENDITEM, 
		"Name=nZoom", "Value=9", ENDITEM, 
		LAST);

	web_url("mv.mapbar.com_2", 
		"URL=http://mv.mapbar.com/?120.46259,41.58264@9@kt04rfe*www.mapbar.com@LW@FU@3@2@8890@mapbar@1@base@mapbarw74", 
		"Resource=0", 
		"RecContentType=text/html", 
		"Referer=http://90.0.12.120:8080/YGBXWebGIS/phoneDispatcher.html", 
		"Mode=HTML", 
		LAST);

	return 0;
}


 

 

JS脚本:

function forward3() {
	Ext.Ajax.request({
		url : "TextPhoneServlet",
		method : "post",
		params : {
			type : 'paraToGPS',
			province : '',
			city : '',
			district : '',
			agencyCode : '01520000',
			policyno : '1375105082011000113',
			accidentno : 'C375105082011903085',
			insured : '',
			insuredid : '11111111111111',
			insurednumberplates : '',
			frameno : '9043829048',
			engineno : '09849023423432',
			surveysites : '',
			isSecondDspatcher : true,
			lon : '120.46344',
			lat : '41.58501',
			zoomlevel : '9'
		},
		success : function(req) {
			var json = Ext.util.JSON.decode(req.responseText);
			var count = json.count;
			var sessionid = json.sessionid;
			if (count == 0) {
				//alert('传输参数存入memcache成功!二次调度,传入经度:123.90115,传入纬度:41.67399,承保机构是:辽宁分公司营业部,机构代码是:12110000');
				 
				 if(mapwin!=null){
					 try{
						//alert('mapwin:'+mapwin);
						mapwin.close(); 
						mapwin.dispose();
					 }catch(e2){
						
					 }
					 mapwin = null;
					 //CollectGarbage();
				 }
								
				//mapwin = window.open('fullmap.html','_blank');
				mapwin = window.open('LoginPhoneDispatcherServlet?username=wc&password=1&delsession=no&sessionid='+ sessionid,'_blank');
				//mapwin = window.open('fullmap.html?random='+ Math.random(),'_blank');
				//向memach写入电话号码
				//writeTel();
				var inter = window.setInterval(function() {
					//判断有无电话号码
					//readTel();
					if (mapwin.closed) {// 这里用于检测窗口是否关闭,如果关闭将触发读取和回填动作
						window.clearInterval(inter);
						// 此处做读memcache处理
						Ext.Ajax.request({
									url : 'PhoneDispatcherServlet',
									method : 'post',
									success : function(req) {
									//alert('success');
									var json=Ext.util.JSON.decode(req.responseText);
									//alert(json);
									//alert('pointAddress:'+json.pointAddress+'pointLon:'+json.pointLon+'pointLat:'+json.pointLat+'maplevel:'+json.maplevel+'personName:'+json.personName+'personMobile:'+json.personMobile+'personWorkcode:'+json.personWorkcode+'allopatryName:'+json.allopatryName+'allopatryMobile:'+json.allopatryMobile+'allopatryWorkcode:'+json.allopatryWorkcode+'isOrientation:'+json.isOrientation);
									},
									params : {
										type : 'getParaByPhone',
										sessionid : sessionid
									}
								});
						// 此处做回填处理
					}
				}, 1000);
			} else {
				alert("调用TextPhoneServlet成功,但后台数据处理失败,请稍后再试!");
				return;
			}
		},
		failure : function(res) {
			alert("调用TextPhoneServlet失败,请稍后再试!");
		}
	})
};


 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值