≡ Menu
Joe Colantonio – Selenium-UFT-QTP-SoapUI-ALM-LoadRunner & more

VIDEO – How to test a web service using HP’s LoadRunner

VIDEO – How to test a web service using HP’s LoadRunner post image

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

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

28 comments… add one

  • Aravindd

    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

    • Joe Colantonio

      @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

  • Aravindd

    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

    • Joe Colantonio

      @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.

  • Aravindd

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

    Regards
    Aravind

  • Joel Wingert

    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

    • Joe Colantonio

      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!

    • Joe Colantonio

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

  • Joel Wingert

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

  • madhuri

    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!

    • Joe Colantonio

      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

  • Shrenik

    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

    • Joe Colantonio

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

  • lokesh

    How to define Fast query path in XML-find or Get XML values

  • Dipak

    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.


  • Rao Farhan

    Thanks … Its really helpful

  • Manish

    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

    • 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.

  • Vishal Saxena

    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

    • 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= …)

  • Vishal Saxena

    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

    • Vishal Saxena » Dumb question — but are you sure that you have the correct permissions for your username?

  • Vishal Saxena

    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.

  • Vishal Saxena

    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

  • Bob

    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

  • uft

    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.

  • javeed

    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

Leave a Comment

css.php