Web Services in loadrunner: We can do web services scripting in two ways:
Note :- if their is any proxy settings click on connection setting and enter the proxy credentials or any specific frame u want to use , click on advance settings and select the frame work
Sample WSDL :- http://www.webservicex.net/globalweather.asmx?WSDL.
It will create a script in loadrunner as shown below. You can perform the steps one by one in this way for all the web services steps. You can use lr_xml_find and lr_xml_get_values to validate the page.
web_service_call( “StepName=GetCitiesByCountry_101”,
“SOAPMethod=GlobalWeather|GlobalWeatherSoap|GetCitiesByCountry”,
“ResponseParam=response”,
“Service=GlobalWeather”,
“ExpectedResponse=SoapResult”,
“Snapshot=t1396977083.inf”,
BEGIN_ARGUMENTS,
“CountryName=India”,
END_ARGUMENTS,
BEGIN_RESULT,
END_RESULT,
LAST);
We can create the same request using Web (HTTP/HTML) protocol. You need take the xml request as shown in the following and place in the web custom request.
Go to Design -> Insert in Script -> New Step tne web_custom_request
We need a xml input request to create the web custom request like below
Now enter the soap body,method and URL in the web custom request properties like below,
After entering all the values click on and it will generate below code.
web_custom_request(“Weather SOAP Request”,
“URL=http://www.webservicex.net/globalweather.asmx“,
“Method=POST“,
“TargetFrame=”,
“Resource=0“,
“RecContentType=text/xml“,
“Referer=”,
“Mode=HTML“,
“EncType=text/xml; charset=utf-8“,
“Body= Your Request should be here as shown in the following image”
LAST)
Now we have to necessary headers tag above this code in your script
web_add_header(“Connection”, “Keep-Alive”);
web_add_header(“Content-Type”,”text/xml;charset=UTF-8″);
web_add_header(“Accept-Encoding”, “gzip,deflate”);
Now save your script and run the script.