Sumilating
RESTful web Services using LoadRunner
REST Services can be scripted using web_custom_request by adding appropriate headers using web_add_header function before the web_custom_request.
An example for REST services script is given below.
/*********************************
web_add_header ("X-ELS-APIKey","11111");
web_add_header ("X-Forwarded-For","12.5.28.133");
web_add_header ("Accept","text/xml");
web_custom_request("web_custom_request",
"URL=http://host:8080/content/abstract/*********",
"Method=POST",
"TargetFrame=",
"EncType=text/xml; charset=iso-8859-1",
"Resource=0",
"Referer=",
"Mode=HTTP",
"Body=",
LAST);
*****************************/
If you want to verify the response manually, you need to set up the header values first in your browser.
Please find below the steps for setting up the header using mozilla firefox browser.
REST Services can be scripted using web_custom_request by adding appropriate headers using web_add_header function before the web_custom_request.
An example for REST services script is given below.
/*********************************
web_add_header ("X-ELS-APIKey","11111");
web_add_header ("X-Forwarded-For","12.5.28.133");
web_add_header ("Accept","text/xml");
web_custom_request("web_custom_request",
"URL=http://host:8080/content/abstract/*********",
"Method=POST",
"TargetFrame=",
"EncType=text/xml; charset=iso-8859-1",
"Resource=0",
"Referer=",
"Mode=HTTP",
"Body=",
LAST);
*****************************/
If you want to verify the response manually, you need to set up the header values first in your browser.
Please find below the steps for setting up the header using mozilla firefox browser.
- Open firefox. Click "Add-ons" from tools menu
- Click "get Add-ons" tab.
- Type "HTTP header" in the text box for search all add-ons and enter.
- In search results, click on "Add to firefox" for "Modify Headers 0.6.6" and install. Now you can see "Modify Headers 0.6.6" in the extension tab.
- Click on "Modify Headers 0.6.6" from the "Extensions" tab and select the check box for "Always on" and "Open modify header in a new tab" and close.
- Now click "Modify headers" from the firefox tools menu and add the appropriate header name and value for your request.
Now launch the URL in the firefox browser and verify the response manually.
Also refer RESTClient addon available for firefox to test RESTful services
No comments:
Post a Comment