Saturday, December 22

Testing oData Service using External Test Clients like ARC and Postman


1. Introduction
2. Google's ARC client
3. Concept of oData Write Operations without CSRF token
4. Google's Postman.


Introduction
SAP provides a testing environment for oData services called ‘Gateway Client’ which is an inbuilt tool in SAP NetWeaver Gateway System. It is meant for testing GET, POST, PUT, and PATCH, MERGE, DELETE http methods.
During SAP implementation projects, oData services also gets consumed in non-SAP application clients for example consuming oData service on an Android based mobile app. In such scenarios, testing oData services using an external client like ARC or Postman becomes critical. In this blog, we will see how to test oData service using ARC client and Postman.

Google’s ARC Client
First you need to Install ARC on your google chrome browser. After installation, click on Apps.
You will be able to see all the Apps installed on your Chrome browser like below.
Click on ARC icon, below page will be displayed. Where you need to enter your oData service's URL and select the type of Request like GET, POST, PUT etc...
Then Click on Send button, that it, you are done. This is equivalent to oData read operation, If you are connected to network from where your SAP Netweaver gateway system is accessible, your read request will go all the way to Gateway and fetch necessary information and display in XML format in below manner.

Concept of oData Write Operations without CSRF token
You can also add headers to your HTTP request. For example, if you are doing a POST request (i.e. write operation for your oData), you need to send X-Requested-With header and its value to be set a 'X'. When such a header is sent for a oData write operation, ICF of your netweaver gateway system will not check for X-CSRF-Token. Other wise for any oData write operation, CSRF token is a must.

In addition to sending X-Requested-with header, you also need to sent ~Check-CSRF-Token parameter's value to 0 at the ICF service level of your oData service. You can do this in SICF transaction of your gateway system as shown below.






No comments:

Post a Comment

You are welcome to express your views here...