It is possible to test web services using the standard Web (HTTP/HTML) virtual user type instead of the Web Services vuser type. The main disadvantage of this is that you cannot generate your SOAP body from the WSDL file using the VuGen wizard. But if you know what your XML request should look like, then you shouldn't have any real problems.

Here are my tips:

  • Send your SOAP payload using lr_custom_request().
  • Add a SOAPAction HTTP header using web_add_header().
  • Remove unnecessary HTTP headers (that are generated automatically by VuGen) with web_remove_auto_header().
  • Don't forget to verify that you get a valid response. Use web_reg_find() for a simple check. For better verification of the SOAP response use lr_xml_find().
  • To extract values from the response body, use lr_xml_get_values(). Brush up on your XPath qeries beforehand though.
  • It may be necessary to HTML-encode some characters in your XML/SOAP message (e.g. convert "&" to "&"). Unfortunately VuGen does not provide this functionality (but HP could easily add it to the web_convert_param function), so you will have to either write (or find) a function to do it, or convert all the entries in your data table before running the script.

As an example, here is a simple script that makes use of a web service that will look up the source of a Shakespeare quote for you.

  // ContentCheck Rules for known error messages
  web_global_verification("Text=Speech not found", "ID=SpeechNotFound", LAST);

  lr_start_transaction ("Search For Shakespeare Quote");

  // By default, VuGen sends a user-agent header.
  // Let's remove this as an example of removing automatically generated headers.
  web_remove_auto_header("User-Agent", "ImplicitGen=No", LAST); 

  // Add a SOAPAction HTTP header
  web_add_header("SOAPAction", "");

  // Save entire body from the HTTP response for later checking with lr_xml_find.

  // Note that the text to search for would normally be replaced with a parameter,
  // and so would the  element of the below SOAP message.
  web_reg_find("Text=TWELFTH NIGHT", LAST);

  web_custom_request("Search Shakespeare", 
    "EncType=text/xml; charset=utf-8", 
    "Body=" // As it is SOAP, you are unlikely to have to use BodyBinary, unless your request has CDATA.
    "Be not afraid of greatness"

  // The response from the web service looks like this:
          'Be not afraid of greatness:' 'twas well writ.</SPEECH>

  // An example of extracting the a value from a SOAP reponse.
  // This saves the  element into {OutputParameter}.
  // The same syntax could be used with lr_xml_find to check the response.
    "Query=/soap:Envelope/soap:Body/GetSpeechResponse/GetSpeechResult", LAST);
  lr_output_message("Source of Shakespeare quote: %s", lr_eval_string("{OutputParameter}"));

  lr_end_transaction ("Search For Shakespeare Quote", LR_AUTO);

  return 0;

Tech tips from JDS


Hi, I am having trouble with the xml extract and xml find. I tried similar format with my response and the function is not able to find or extract. I ran the same example above and see that the lr_xml_extract is failing. Can you help, please?

Daniel Spavin
Daniel Spavin

Hi Deepa,

I copied the code into a new script and it appears to be working now – have another go.

Getting the XPath can be tricky, but there are a few different websites that can help. Online validators let you paste in your XML and check your XPath expressions return results. Try googling ‘online xpath validator’ and pick one that suits.

Thanks Daniel for the quick response. I will try again. I am wondering if it is the version of Vugen I am using. I see some other people posting some issues with XML functions with this version.

I used an online tool for xpath as per your suggestion and it worked.Thanks so much.

Hi there,

I am using LR 11.52 and trying to pass a soap request using web_custom_request.

When script is replayed, it is throwing Internal 500 error. I have checked the request in the LR output log and it seem to be correct.

Also, the same request is displaying correct response when run in SOAP UI.

Could you tell me possible causes/ solution?

I have attached the script too.


Hi Stuart,

I was going through the various topic listed here..
Could you please help me out in the problem listed below-
Problem -> I have a .Net WebAPI for fetching the data from the database.
It is using JSON data to POST the requests.
In the Request Body we pass the required parameters and in Headers we pass the “Security token” along with other parameters.
Developer has written a logic to Generate the Unique Security token each time and add into Header, before posting the JSON body.

I have the DLL which has the logic of generating the security token.
The Problem is -> How can i use this DLL so that, EACH time when i run the script from VUgen, it will ADD the Security token parameter in the HEADERS and After that POST the request body.
It is something like (in simple words) – When we run the VUgen script -> The DLL methods will add the Security Token parameter in the Headers and THEN, the Scripts execution will proceed with this security token and Post the request to server.

Could you please let me know, if it is possible to ADD the security token in the PRE Request ?
Note – VUgen script i have created using the Fiddler’s .SAZ file and it contains the web_custom_request() method
let me know, if you need any more information.



Thanks for the helpful information!

I want to test file upload using Loadrunner for Web Services, is this feasible? It would be a great help if you can guide me with few steps.


I need a load runner script to capture the CPU , Memory utilization.
i have around 70 servers to be monitored , which is impossible for me to manually login and check them indivigually. Is there a way i can do it through load runner

Can someone provide me an exact code in LR, using plink. i was able to run the command but not capture the response

Mohammed Yacoob

I have resolved using simple perl programming and interconnected to Load Runner to capture CPU, Memory, Disk and IO utilizations

Hi , Can you please help me to capture the XML request not the response.

Reason for this , Development team require to debug the xml request based on the response which we are receiving from the server for the different kind of data.

How to map WS configuration in HP Load Runner for web service protocol:

I have imported WSDL and included the certificate with the help of web_set_certificate function. but again some behind wsi configuration need to setup. Any one have any idea how to map it?

In SOUPUI Pro -> have an option to include one configuration. Each configuration will have a Username and a Signature entry.
These entries will be applied to the corresponding outgoing SOAPUI message in the Security Header when the message is sent.

Go to project name “test”, right-click
Select “Show Project View”
Go to “WS-Security Configurations” tab
Click the Add button

vipul Malgotra

I am trying to performance test a web service using web_custom_request but the web service requires server authentication and i am getting below error.

Action.c(6): Error Exceptions:
Action.c(6): System.Exception: Soap error:
Message:ITW Agent cannot locate all required security information.Username is missing. Password is missing.
at Mercury.LR.LrWsNetClient.ProxyCreator.InvokeMethod(String sMethod, IWSMethodParameters mParams, String sAsyncEvent)
at Mercury.LR.LrWsNetClient.NetReplay.InvokeMethod(String sMethod, IWSMethodParameters mParams, String sAsyncEvent)

Action.c(6): Error:Expected SOAP result, received SOAP fault
Action.c(6): Error:Failed to retrieve output arguments/checkpoints – SOAP fault occurred

I tried using web_set_user(“username”, “password”, “”) function but did not work.

Could you please help me get through this?

Thanks in Advance

I am doing performance testing of an desktop application, the communication protocol is web service so I adopt the approach to do the webservice scripting using HTTP/HTML protocol.

Cliet application is developed in .net and server is windows 2003. I have build the Loadrunner script successfully, while executing the same I am facing below error . I am struggling a lot in order to fix this issue . Any sort of help is really appreciable .
Action.c(16): Continuing after Error -26630: HTTP Status-Code=401 (Unauthorized) for “” [MsgId: MERR-26630]


I am trying to create a web_custom_request using XML to test web service. In web_custom_request which URL needs to used? Is it WSDL or anything else? What is the exact terminology used for this URL? I am not able to understand which url to ask from dev team to use in custom_request. Can someone please help me?


[…] I want to loadtest a web service by creating a SOAP request in SoapUI and pasting it into a regular LoadRunner web virtual user within a web_custom_request(). This should be straight forward and is described i.e. here: […]

why should we need web_custom_request in web services.




I am using large xml files could you please give us the solution how to test the big size xml(5MB). For web svc protocol


Hi Team,

Can you pls help me resolving this issue i got struck over here for past 2 days,searching for the solution

ie i am trying to place an webservice request, as specified above. But after execution it is throwing error as

Error -26631: HTTP Status-Code=400 (Bad Request) for

[…] of good info for people testing web services (people should also read my Testing Web Services With a Standard Web Vuser […]

I am trying to post the xml to the web service, but i get the 500 Internal error as below.

response headers for “http://wbv-oal-t0001/Outage_Communicator/getOutageCommunicatorServiceStatus.asmx” (RelFrameId=1, Internal ID=1)
HTTP/1.1 500 Internal Server Error\r\n

Can you please help me if I am missing anything in the script.

web_add_header(“Content-Type”,”text/xml; charset=ISO-8859-1″);

” \r\n”
” \r\n”
” \r\n”
” 01\r\n”
” 0101\r\n”
” \r\n”
” \r\n”


I guess, in order to post web service request via http/html protcol(use web_custom_request) a web page is required.
The purpose of the web page is to take input parameters for the XML/SOAP request to the server.

What are the criteria for designing a web page to host XML/SOAP requests?

If the above approach is not correct, can you please guide me with the right information from scratch- how to use web_custom_requests i.e post web services via http/html?

Thanks much in advance.

Stuart Moncrieff

If you are looking for a web service to practice writing a LoadRunner/VuGen script for, then you should look at the API Directory from ProgrammableWeb.

If you are wanting to develop your own web service, then you will need a web server with a server-side scripting language like PHP or C#. Once you know what language/platform you are using, it should be easy to find a tutorial on creating web services.

Using someone else’s web service is the easiest way to go if you just want to practice creating LoadRunner/VuGen scripts though…



I have a query regarding a mixed approach taken by project. It is a mixed approach of WebMethods and HTTP Post method.

Project is using WebMethods for integration. But it is not using SOAP or WSDL. It is just exposing method. A .NET client is using MSXML2.XMLHTTP40 object to send data (XML) using HTTP POST method.

I have to emulate similar. I tried code to submit data using web_custom_request and web_submit_data. I can login fine using web_set_user. But i receive HTML status code – 403 when code moves to submit request.

Following is a web_custom_request call: (do note that I have changed certain parameters)

    "EncType=text/xml; charset=utf-8",

Would you please be able to help.


Stuart Moncrieff

An HTTP 403 response means that authentication is probably failing. It would be a good idea to have a look in the web server log to see if there is more information about why it is failing (i.e. sc-substatus and sc-win32-status).

I am happy to have a look at your script if you send it to me.


Tauhid Khan

Could you please let me know what I need to do when accessing the URL needs authentication. What will need to be changed in the “web_custom_request” code block.

[Stuart’s Reply: To handle a web service that requires authentication, you need to put a call to the web_set_user() function at the top of your script.

This function supports Basic authentication, Digest access authentication, NTLM, NTLMv2, and Kerberos (with some extra mucking around).

Note that if the username you are authenticating with is on a domain, you may have to include the domain in the username field. e.g. web_set_user(“domain\\username”, “password”, “”). ]

Stuart Moncrieff

Waldemar Sojka has written something simlar for his blog: Web Services performance using LoadRunner HTTP Vuser script