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

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.

XML Request Example for Web Custom Request
XML Request Example for 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);

http://3.bp.blogspot.com/-vcn2IalCk0Y/U0V__Gdc5uI/AAAAAAAABaQ/qW1e1jH9tFU/s1600/web+custom+request+in+web+services.png

Comments

Post a Comment

Popular posts from this blog

Lr Advance Param Function In Loadrunner With Example

web_set_max_html_param_len

Error -27492: "HttpSendRequest" failed, Windows error code=12057 (certificate revoked) and retry limit (0) exceeded for URL="