Home > LoadRunner > Web Services performance using LoadRunner HTTP Vuser script

Web Services performance using LoadRunner HTTP Vuser script

January 24th, 2009

Small (basic) example howto test performance of Web Service using LoadRunner API.

Let say we have a web services that uses SOAP over HTTP. We want to check how fast we can send a request and receive a response.  Because our service uses HTTP as a transport protocol, we are able to test it using simple HTTP Vuser script.

Here is the C code:

  1. Action()
  2. {
  3.    web_reg_save_param("Response","LB=", "RB=", LAST);
  4.    web_add_header("SOAPAction", "SampleMethod");
  5.    lr_start_transaction("REQ");
  6.    web_custom_request("Sample_Request","Method=POST",
  7.          "Mode=HTML",
  8.          "RecContentType=text/xml",
  9.          "EncType=text/xml; charset=utf-8",
  10.          "URL=http://example.com:1234/sample/",
  11.          "Body=<Envelope xmlns=\"http://example.com/sample\">\n"
  12.                "   <Header/>\n"
  13.                "   <Body>\n"
  14.                "      <price><id>001</id></price>\n"
  15.                "   </Body>\n"
  16.                "</Envelope>",
  17.    "LAST");
  18.    lr_end_transaction("REQ", LR_AUTO);
  19.    lr_output_message("Response is : %s\n", lr_eval_string("{Response}"));
  20.    return 0;
  21. }

Have a fun…

Comments are closed.