Performance Testing

LoadRunner Web Service Tutorial: Learning the Basics

By Test Guild
  • Share:
Join the Guild for FREE

LoadRunner is a powerful tool for software testers. It helps to identify and correct problems with applications before they go into production. But it can be quite intimidating to get started.

In this LoadRunner web service tutorial, we'll walk you through the basics of performing load testing web services with this tool. This post is an introduction to how LoadRunner works for web service testing

By the end of this tutorial, you'll be ready to start load testing your own web services.

INDEX

What is a web service?
What is LoadRunner?
Web Services by LoadRunner Tool
LoadRunner Features in Load and Performance Testing
When to Use LoadRunner
Conclusion

What is a web service?

A web service is a crucial component of today's Internet. It provides standardized methods for propagating messages between client and server applications. It is an excellent way to exchange data between different applications, systems, or programs running on the same computer network. It also provides an easy means for open protocols and standards that allow information to be sent over internet connections, much like how processes communicate internally within your own operating system without needing any extra ports opened up.

Think of web services as a platform for connecting and exchanging data. They're available on any device, anywhere in the world.

Today, web services are popular as they provide an easy way for companies to transfer data. This makes them the target of Performance tests, which check how fast your service can respond or deliver content with a given amount of input information. And among the best tools used by software testers to test web services these days is LoadRunner.

What is LoadRunner?

HP LoadRunner is a software performance testing tool. It can detect and prevent issues in web applications before they enter the implementation or deployment phases. It specializes mainly in identifying potential bottlenecks. It also has some features for finding out if there are any gaps during system upgrades, too.

LoadRunner gives testers the power to see how your system will perform before you release it. With a single tool, they can evaluate each component individually. They can also identify any issues or bugs that might affect their performance test results- saving time in fixing these problems later on.

Moreover, LoadRunner’s forecasting features help you plan for the future. It can predict what it will take to keep your application running smoothly. With accurate estimates of both software and hardware expenses, scaling up is easy.

Web Services by LoadRunner Tool

This video shows how to test a web service using HP's LoadRunner.

I also demonstrate how to validate a web service response using the LR_XML_FIND function:

lr_xml_find(“XML={CreateFlightOrder_101_Response}”,
“Query=CreateFlightOrderResult/TotalPrice”,
“Value=125”,
LAST);

When performing web service scripting using LoadRunner, you can do it in two ways:

  1. Using Web Services Protocol (this require an additional license)

Step 1: Open the Vugen and choose Web Services protocol

Step 2: Click on Manage Services, then click on Import, and provide the WSDL URL OR

(SOA Tools > Manage Service > Add file or URL or UDDI)

Important Note: For any proxy settings, go to connection settings and input the proxy credentials. You may also enter the frame you want by going to Advanced settings and choosing the framework.

Step 3: Click on Add Web Service Call. Provide the Input Arguments (leaving the Output Arguments empty). Then, click on OK.

Performing these steps will create a script in LoadRunner. To validate the page, you can use lr_xml_find and lr_xml_get_values.

  1. Using Web Protocol

You can create a similar request using Web protocol. Just take the XML request and put it in the web custom request.

After that, enter all essential values in the web custom request properties. These include the SOAP body, method, and URL. Once entered, it will generate a code.

Now, save the script and run it.

With protocol scripting, options and procedures may change depending on which web service protocol you choose. You may also explore multiple protocols to become well-acquainted with creating VuGen scripts.

Get Free Training

LoadRunner Features in Load and Performance Testing

Here are the key features of HP LoadRunner:

  • Supports several apps
  • Interactive user transaction simulation
  • Cloud testing
  • Mobile testing
  • Refined user interface
  • Continuous testing
  • Precise scalability expense prediction
  • Root cause analysis
  • Allows users to test various applications, including Java, SOAP, GWT, Citric, legacy, HTML, Flex, .NET, Silverlight, and Ajax

When to Use LoadRunner

Loadrunner gives you an accurate and wholesome image of your application's end-to-end performance. As such, it enables users to detect any bottlenecks immediately with ease.

With this performance testing tool, you can emulate plenty of users simultaneously. You may also prepare your application for a live environment with ease.

During the performance test, LoadRunner collects data from crucial infrastructure components. It analyzes the information in detail to provide pertinent insight into why the app is misbehaving. Thus, you can easily detect the root causes of any defect your app might have.

Furthermore, LoadRunner gives performance testers options for testing mobile applications. You can evaluate your app's ability to perform on different devices as well as with backend systems or networks in place – all from one convenient location.

And with the Loadrunner cloud-based testing service, you can perform realistic load tests anywhere.

Conclusion

So, there you have it – the basic knowledge about LoadRunner and how to use it for web services performance testing. This is a powerful tool, but like with anything else, the more you know about it, the better off you’ll be. And as always, if you need assistance in getting started with performance testing using LoadRunner or have any questions about any other performance testing tool, don’t hesitate to reach out to us.

To see how to test a RESTful web service, check out my post How to test a RESTful web service using HP’s LoadRunner.

Subscribe to the Blog

  1. I am going thru your video and I have HP Loadrunner 11 trial installed and was trying to use this url to import http://localhost:24240/HPFlights_SOAP?wsdl
    getting this error

    can not fetch WSDL data: http://localhost:24240/HPFlights_SOAP?wsdl
    The specified WSDL may be incompatible with the selected toolkit.
    Try using a different toolkit

    My localhost is up and running. I pinged and tested.
    Is there anyway to get around this are is there any other url I can try to practice.
    Appreciate your help.

    Regards
    Aravind

  2. @Aravindd: I usually get that error if I try to import the WSDL when the application is not running.
    For the video example the web service I’m using is a sample flight application that came with HP Service Test 11.  If the sample flight application is not running and I try to import the WSDL I get the same error. Make sure you have the sample application up and running. If you don’t have the sample application you can get it by downloading HP’s Function Testing 11 eval from:

    https://h10078.www1.hp.com/cda/hpms/display/main/hpms_content.jsp?zn=bto&cp=1-11-127-24^1352_4000_100__

    Hope that helps.

    Cheers,

    Joe

  3. Hi Joe,
    Thanks for the reply.
    I have Loadrunner 11 Eval Version installed, and it came HP Web Tours App. The webserver(localhost) is started and the application is up and running. Why cant I use that App. Doesnt it come with the WSDL’s.
    Or did you use the HP’s Function Testing 11 eval’s Application instead of HP Loadrunner eval’s App and used Loadrunner webservices to import the wsdl. Please explain.

    Regards
    Aravind

  4. @Aravindd: Sorry for the confusion – I’m not using the flight application sample that came with LR (that is a web app). I’m using the Sample Flight application that came with HP’s Functional test tool “Service Test 11′ which is a “web service” version of the flight application. I then used Loadrunner’s Web Service protocol to import the ServiceTest WSDL. You could also take a look at : http://www.webservicex.net/ws/wscatlist.aspx for other webservices to try.

  5. Hi Joe,
    Thanks for your immediate response.
    I will install HP Service test 11 and try the LR and let you know.

    Regards
    Aravind

  6. Hi,

    No offense, but…

    I tried using this video to learn the lr_xml_find function, but it’s way to blurry and the video cuts out a few important phrases, such as exactly what string are you using for the Xpath. The video cuts that part of the audio out, and the video is too blurry to see what you are putting in there.

    Joel

  7. Hi Joel – Sorry about that – let me dbl check and make sure I posted the right video— I’ll create a new video if the current one somehow got corrupted. Thanks for the feedback!

  8. Joel Wingert » Unfortunately is looks like I delete the original pre-edited video. It may take me a few days to redo. The code for the LR_XML_Find that I used for the video is:

    lr_xml_find(“XML={CreateFlightOrder_101_Response}”,
    “Query=CreateFlightOrderResult/TotalPrice”,
    “Value=125″,
    LAST);

  9. Ok thanx much… Sorry if I sounded brash… It’s just the way it came out, so to speak, but no ill was intended…

  10. Hi,
    I feel the video is not so clear and also felt the screens turned so fast which is a little hard to follow for beginners.So when u update ur next video make sure u go slow and clear.

    Thank You so much for ur help!

  11. madhuri » Thanks for the advice madhur! I’ll keep it in mind next time I post a video. I try to keep my videos under 5 minutes so I think that is part of the problem. Also my newer video’s picture quality should be better. Cheer~Joe

  12. Hi,
    I am scripting for 2 way SSL web service scripting. I can open WSDL URL in IE after giving private key.
    While trying to import WSDL in LR 11, I am getting error saying “the specified wsdl may be incompatible with the selected toolkit”.

    Regards,
    Shrenik

  13. Shrenik » Hi Shrenik – rather than try to import the WSDL have you tried to use the ‘Import Soap’ feature instead?

  14. Hello Joe,
    Thanks for the vedio. I have imported the WSDL file. The payload for this WSDL looks like below. When I import it the values I see in LR as . Though I am able to execte the script with out any errors but message does not pass though. Your help is appreciated.


  15. Hi Joe,

    I tried the add webservice call in LR 11.5 and its working fine but when i try the same webservice in LR 9.5, its giving me error-

    InvokeMethod failed- org.xml.sax.SAXException:Bad envelope tag: html
    Details-Error while retrieving body- cannot parse output parameters.

    Could you please help me in resolving this error.

    Thanks,
    Manish

  16. Manish » Hi Manish not sure why it would work in 11.5 and not 9.5. Do you have the latest patches for 9.5 installed? I did not find this as a known issue in HP’s KB.

  17. Hello Joe,

    I have resolved my issue to some extent. The error message I was getting earlier was due to misplaced “Mode=HTML”, “RecContentType=text/xml”.

    Now, I am stuck with another error message “Error -26628: HTTP Status-Code=403 (Forbidden)”. I have also tried adding web_set_user(“username”,password”, host:port”); but still the request fails.
    The request ask for its authentication when it is hitted on explorer.
    Can you please suggest.

    Regards,
    Vishal Saxena

  18. Vishal Saxena » For 403 errors when using NTLM authentication try verify the following:
    1. Make sure that information in web_set_user is correct.

    Example:
    Assumptions:
    Username: usr
    Password: my_passwd
    Domain: spark
    Web server name: lazarus
    Port: 80

    Given the above, the function should be

    web_set_user(“spark\\usr”, “my_passwd”, “lazarus:80”);

    Note:
    The domain name “spark” followed by a double backslash must be appended before the username.
    NTLM Authentication is supported by Sockets Replay Engine (default) from LoadRunner 7.5 and above.
    Make sure that there are no special characters in the username/password. Special characters include (:;&*\”/#~,?{}$%|<>+.”@^()[]+-)\\.

    2. Try to add the following statement before the web_set_user function. This forces the connection to the server to a particular protocol rather than letting the server suggest one during the connection handshake:

    web_set_sockets_option(“SSL_VERSION”, “3”);

    3. Replay your script in the extended log with “Advance trace” to verify the information sent to your server. Then, compare the header request of the execution log with the one that was used during recording from the Recording Log (for Single Protocol) or Generation Log (for Multiple Protocol). If there is missing information, add it to the script using a web_add_cookie statement. For example, if you see “SMCHALLENGE=Yes” in the Recording or Generation Log, but not on the execution log, add the following to the script before the web_url request:

    web_add_cookie(“SMCHALLENGE=Yes ; path…; domain= …)

  19. In addition to my earlier post , to share with you the error that is being thrown by the application is,
    h2> Access is denied. \r\n
    Action.c(19): \r\n
    Action.c(19): \r\n
    Action.c(19): \r\n
    Action.c(19): Description: An error occurred while accessing the resources required
    Action.c(19): to serve this request. The server may not be configured for access to the requested URL.\r
    Action.c(19): \n
    Action.c(19): \r\n
    Action.c(19): \r\n
    Action.c(19): Error message 401.2.: Unauthorized: Logon failed due to server configu
    Action.c(19): ration.  Verify that you have permission to view this directory or page based on the
    Action.c(19): credentials you supplied and the authentication methods enabled on the Web server.  C
    Action.c(19): ontact the Web server’s administrator for additional assistance.\r\n
    I even tried adding below statements,
    web_add_header(“Host”, “server”);
    web_add_header(“Authorization”, “username:password”);

    Any help shall be appriciated.

    Regards,
    Vishal Saxena

  20. If it would have been, I might not have asked :). Surely, I am having those permissions, otherwise it would have failed doing manually also. Am I correct Sir? Thanks Anyways. Will update the error cause at your forum, once I resolve it.

  21. Hello Joe,

    First of all, I would llike to share the reason for failure of my custom request as discussed in previous posts.
    It was the authorization part, that was being incorrectly sent. Below was the resolution I found & it worked,
    – Earlier I was using ,web_add_header(“Authorization”, lr_eval_string(“Basic {p_Username}””:””{p_Password}”));
    which was WRONG.
    The string {p_Username}””:””{p_Password} was encoded by base64 encoder, therefore passing the encoded string actually worked.
    This was checked from SOAP UI HTTP Log.

    Now, I am again stuck while making a test-run on Controller. Below are the RTS details-
    Use Winlet replay engine instead of Socket engine (script fails using Socket)
    Issue- Vusers does not increases beyond INIT state after 2-3 are on run, when I try to execute the same with localhost as agent, It ramps up to 20 vuser. This is a very strange behaviour, But I am actually stuck due to this.
    Your advice might prove worth again.

    Please help. Thanks in Advance Joe.
    Regards,
    Vishal Saxena

  22. hello Joe,
    i am try to set transaction pass and fail base on web service output value. i set web service output value as following

    GetResult=result

    then i put parameter in output message as following

    lr_output_message(lr_eval_string(“{result}”))

    here, i am having issue. where i am trying to set transaction pass or fail base on web service output of result.

    if (lr_output_message(lr_eval_string(“{result}”)) == “APPROVE”)

    lr_end_transaction(“XXXXX”, LR_PASS);

    else
    lr_end_transaction(“XXXXX”, LR_FAIL);

    return 0);

    can you tell me where am i making mistake in If statement? thanks

  23. Hello Joe,

    How to parametrize the security Username & Passswords fields under HTTP tab for any API Test in UFT? Right now I can only enter a specific field value and I want to iterate it with multiple values.
    In ST 9.5 I can use the web_set_user command for same.

    Please assist.

    Thanks.

  24. Hi Joe,

    I am unable to import the xml/wsdl files in Loadrunner and getting error as “The specified WSDL may be incompatible with the selected toolkit.Try using a different toolkit”. Please give me the solution to fix the above one.

    Regards,
    Javeed
    javeed369@gmail.com

  25. Hi Joe,

    I am trying to create one load test for web service. when I am running it, it throws soap fault error. I have added expectedResult= “AnySoap” in the script as read through some blogs. It doesnt work.
    Need your help Please.

    Regards,
    Shalini

Comments are closed.

{"email":"Email address invalid","url":"Website address invalid","required":"Required field missing"}

Unlock the Power of Continuous Performance Engineering

Posted on 03/25/2024

With the current demand for software teams to high quality product in a ...

16 Top Load Testing Software Tools for 2024 (Open Source Guide)

Posted on 03/12/2024

In the world of software development, testing is vital. No matter how well ...

What is Response Time Testing (Performance)

Posted on 03/01/2024

Unhappy user experience and lost revenue are all side-effects if you don't get ...