Working with web services Protocol
Web Services:
Web Services in loadrunner: We can
do web services scripting in two ways:
1.
By using Web Services Protocol.
(Need additional License)
2.
By using Web Protocol.
Scripting Using Web Services
Protocol:
I
have taken weather web service as example shown in this link.
Steps:
1.
First open the vugen and select
Web Services protocol.
2.
Click on Manage Services on top
nav bar and Click on Import and give the WSDL URL which is usually ends with
wsdl
Now
Click on Add Web Service Call on top nav bar. Give the Input Arguments and
Leave the out put arguments empty. And click on ok. As shown in the following
image.
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);
"SOAPMethod=GlobalWeather|GlobalWeatherSoap|GetCitiesByCountry",
"ResponseParam=response",
"Service=GlobalWeather",
"ExpectedResponse=SoapResult",
"Snapshot=t1396977083.inf",
BEGIN_ARGUMENTS,
"CountryName=India",
END_ARGUMENTS,
BEGIN_RESULT,
END_RESULT,
LAST);
Using Web Protocol:
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.
You
need to keep this soap request in the web request body. As shown below and you
can capture all the response using correlation function. You can also add check
point using web_reg_find. The url should end with .asmx as shown in the
request.
web_reg_find("Text/IC=New
Delhi",
LAST);
web_reg_save_param_ex(
"ParamName=Web Service Response",
"LB=",
"RB=",
SEARCH_FILTERS,
LAST);
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);
LAST);
web_reg_save_param_ex(
"ParamName=Web Service Response",
"LB=",
"RB=",
SEARCH_FILTERS,
LAST);
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);
I read like this type of article only. You mentioned more important points in this article. Thankyou for interesting article. i m interested to see this.
ReplyDeleteC and C++ Training Institute in chennai | C and C++ Training Institute in anna nagar | C and C++ Training Institute in omr | C and C++ Training Institute in porur | C and C++ Training Institute in tambaram | C and C++ Training Institute in velachery