Venkat Matta

it's all about the Performance Testing

WS By Loadrunner

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:

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 or
  3. SOA Tools -> Manage services -> Add url or file or UDDI

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.

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
Input Arguments.png

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);

Scripting Using Web Protocol (Http/HTML):

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

Lr_WS

 

We need a xml input request to create the web custom request like below

Input Request

Now enter the soap body,method and URL  in the web custom request properties like below,

Lr_WS_1

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.

Leave a comment

Information

This entry was posted on March 22, 2016 by in Webservices.