You are on page 1of 15

09/04/2018 For Beginners: How to use Gateway Client?

| SAP Blogs

Products
Products Industries
Industries Support
Support Training
Training Community
Community Developer
Developer Partner
Partner About
About  
Home / Community / Blogs + Actions

For Beginners: How to use Gateway Client?


October 14, 2013 | 17,176 Views |

Krishna Kishor Kammaje


more by this author

SAP Gateway
Mobile | debugging | gateway | gateway client | Mobile | mobility | odata | rest

share
0 share
0 tweet share
0

Follow

In this document I explain beginners on how to use the SAP provided Gateway Client to test your OData services.

https://blogs.sap.com/2013/10/14/for-beginners-how-to-use-gateway-client/ 1/15
09/04/2018 For Beginners: How to use Gateway Client? | SAP Blogs

You access the Gateway Client using Tcode /IWFND/GW_CLIENT

We consider the SAP delivered demo service /IWFND/RMTSAMPLEFLIGHT for our use cases.

1. Testing Your OData Service

It is very easy to test ‘GET’ requests using any h p browser, but when it comes to test the ‘POST’/’PUT’ requests,
there comes the challenge of composing the request body which most beginners get it wrong most of the mes.
The worst part is that the response you get for a wrongly composed request body rarely tells you what is wrong.
Even the error logs don’t get you anywhere. SAP’s gateway Client can make your life so easy and let’s find out
how!

1.1 Testing a CREATE

Request Body: For forming the request body, we will first run a READ request. When I run a query for
Travelagency Collec on, in the response body, I get URI for each entry. So I pick up one of the URI and run as
below.

https://blogs.sap.com/2013/10/14/for-beginners-how-to-use-gateway-client/ 2/15
09/04/2018 For Beginners: How to use Gateway Client? | SAP Blogs

Step 1. Do a GET for /sap/opu/odata/IWFND/RMTSAMPLEFLIGHT/TravelagencyCollec on(‘00000055’)

Step 2. Once I get the response, I click on “Use as Request” bu on, which will populate the request body
same as the current response.

https://blogs.sap.com/2013/10/14/for-beginners-how-to-use-gateway-client/ 3/15
09/04/2018 For Beginners: How to use Gateway Client? | SAP Blogs

Step 3. Now change the values in the request body as required. You need to change the key value as there
cannot be more than one record for a par cular combina on of a key. In applica ons where keys are
populated by the applica on, you may leave them as blank. I changed the key value as ‘90000055’ and
NAME as ‘Sunshine Travel New’

Step 4. Change the URI as /sap/opu/odata/IWFND/RMTSAMPLEFLIGHT/TravelagencyCollec on

In the above screenshot you can also no ce that ‘XCSRF-Token’ header is auto populated so making it easy
for you.

Step 5. Change the HTTP method as ‘POST’ and hit F8. You are done! You should get a return HTTP response
as “201: Created” indica ng a successful Create and also returning the created en ty in the response body.

1.2 Testing an UPDATE

Step 1. Same as Step 1 that in the CREATE.

Step 2. Same as Step 2 that in the CREATE. Here you read an entry that you want to Update

Step 3. Here keep the URI as it is. URI should be containing the keys of the record to be updated.

Step 4. Change the request body that got populated, changing non-key proper es.

https://blogs.sap.com/2013/10/14/for-beginners-how-to-use-gateway-client/ 4/15
09/04/2018 For Beginners: How to use Gateway Client? | SAP Blogs

Step 5. Change the HTTP Method as ‘PUT’ Hit F8; you are done. You should get a return HTTP response as
“204: No Content” indica ng a successful Update. Note: In the sample service above you can update a
record which you created. Not the one which already exists.

1.3 Testing a Deep Insert

Hand coding a Deep Insert body is a very tedious job. Here first you need to execute a $expand query. I take
a different example this me. Now I want to create a Carrier with Flights for that Carrier. I see that
Naviga on ‘carrierFlights’ navigates from Carrier to Flights

Step 1. Run a query with below URI: /sap/opu/odata/IWFND/RMTSAMPLEFLIGHT/CarrierCollec on(‘AA’)?


$expand=carrierFlights This will give me Carrier AA, along with all its flight.

Step 2. Hit ‘Use as Request’ bu on as we did previously.

Step 3. No ce that we have Carrier as well as Flights in the request body. Flights are within the node <inline>
and at last you have the Carrier record. Change the keys as required. For example inside the Carrier entry I
put a new non-exis ng ‘carrid’ say ‘ZZ’ and change some other non-key fields. Inside the flight entries, I
change the carrid as ZZ as well. You may remove many flight entries and keep one or two as required.

Step 4. Change the HTTP method as ‘POST’ Hit F8, you are done.

Note: The above example may not run successfully because of Virus scan se ngs of ES1 (Virus Scan comes
into play since CarrierCollec on is marked as hasStream=True; Deep insert itself does not need any Virus
scan se ng). In your system this has to run fine.

https://blogs.sap.com/2013/10/14/for-beginners-how-to-use-gateway-client/ 5/15
09/04/2018 For Beginners: How to use Gateway Client? | SAP Blogs

2. Gateway Client as a Debugging Tool

Gateway Client can be a very good debugging tool. Go to Tcode ‘/IWFND/ERROR_LOG’ to see all the errors that
occurred in your Gateway system. Click on a par cular error. In the below pane you see a bu on called Replay,
and select ‘Gateway Client’ there.

This will open the corresponding request in Gateway Client thus allowing you to see the request as well as the
response.

3. Gateway Tool as your regression testing tool

Each request you execute on gateway Client can be stored as well. This is similar to a variant in any SAP
transac on but with more features.

Step 1. Once you run an opera on, you can store the request as below by clicking on the ‘Save’ bu on as below.

https://blogs.sap.com/2013/10/14/for-beginners-how-to-use-gateway-client/ 6/15
09/04/2018 For Beginners: How to use Gateway Client? | SAP Blogs

Step 2. Once saved, you can click on the ‘Select’ bu on (next to ‘Save’) and retrieve your test case.

Step 3. You can store mul ple test cases under a Test Group as below. You can set expected status by clicking on
the bu on as shown below.

https://blogs.sap.com/2013/10/14/for-beginners-how-to-use-gateway-client/ 7/15
09/04/2018 For Beginners: How to use Gateway Client? | SAP Blogs

Step 4. You can run them any point of me in future and ensure that they are running as expected. You can also
look at the Request Data and change them as well. A er se ng the Expected Status, select all requests as click on
“Execute” as below.

Note that I have purposefully given a wrong Expected status for demo purpose.

https://blogs.sap.com/2013/10/14/for-beginners-how-to-use-gateway-client/ 8/15
09/04/2018 For Beginners: How to use Gateway Client? | SAP Blogs

Below is the output a er execu ng

I tried here to highlight the most useful features of Gateway client. Hope it helps in your development of
Gateway services.

Alert Moderator

https://blogs.sap.com/2013/10/14/for-beginners-how-to-use-gateway-client/ 9/15
09/04/2018 For Beginners: How to use Gateway Client? | SAP Blogs

12 Comments
You must be Logged on to comment or reply to a post.

Ron Sargeant

October 14, 2013 at 9:10 am

Good document Krishna, hopefully it will help resolve some of those regular problems that are frequently posted about (if they
can find the “Search” option ).

Krishna Kishor Kammaje Post author

October 14, 2013 at 1:43 pm

Thanks Ron. I agree.

Andre Fischer

October 14, 2013 at 6:35 pm

Hi Krishna,

I agree to Ron. Nice document and hopefully the users will find it.

Then they hopefully find also the link to the document that I posted about the demo test cases (CORE_SAMPLES) that are
delivered by SAP as part of the standard that contain several test cases for more complex scenarios such as $batch.

https://blogs.sap.com/2013/10/14/for-beginners-how-to-use-gateway-client/ 10/15
09/04/2018 For Beginners: How to use Gateway Client? | SAP Blogs

http://scn.sap.com/docs/DOC-43087

Best Regards,

Andre

Krishna Kishor Kammaje Post author

October 14, 2013 at 9:21 pm

Thanks Andre.

Hemendra Sabharwal

March 25, 2015 at 7:43 am

Thanks for sharing Krishan, This provided very good understanding on day-to-day tool set. Your document was great help for
me in “Deep Insert”, otherwise I was lost to the jungles.

Thanks,

Warm Regards

Hemendra

https://blogs.sap.com/2013/10/14/for-beginners-how-to-use-gateway-client/ 11/15
09/04/2018 For Beginners: How to use Gateway Client? | SAP Blogs

Vishnu Pankajakshan

March 31, 2015 at 1:18 pm

Thanks Krishna,

Regards,

Vishnu

Ke Li

September 9, 2015 at 5:00 am

Thanks for your sharing, it’s very useful for me!

Sara Zhang

September 9, 2015 at 5:39 am

Thanks a lot, very nice doc.

https://blogs.sap.com/2013/10/14/for-beginners-how-to-use-gateway-client/ 12/15
09/04/2018 For Beginners: How to use Gateway Client? | SAP Blogs

siva shankar

June 4, 2016 at 9:11 am

Thank you very much for this post Krishna Kishor Kammaje.

I have one query, how can we pass parameters to the create_entity method of DPC_Ext class. Could you please help me
regarding this.

Thanks & Regards,

Siva

Juhi Bhatnagar

April 5, 2017 at 6:34 am

Hi Krishna Kishor Kammaje !

Lovely blog , really helpful !

Would you be able to help me with a long GET request which cannot be tested through browser due to browser URL length
limitations. How exactly do we use the HTTP request screen on Gateway client to test very long GET requests ?

Thanks,

Juhi !

https://blogs.sap.com/2013/10/14/for-beginners-how-to-use-gateway-client/ 13/15
09/04/2018 For Beginners: How to use Gateway Client? | SAP Blogs

Amrit Kumar Singh

September 14, 2017 at 11:48 am

Thanks Krishna,

you saved my good amount of time.

Adhimas Setianegara

January 12, 2018 at 4:32 am

Thanks Khrisna. Realy helpful for beginner like me.

Share & Follow Privacy Terms of Use Legal Disclosure Copyright Trademark Sitemap Newsletter

https://blogs.sap.com/2013/10/14/for-beginners-how-to-use-gateway-client/ 14/15
09/04/2018 For Beginners: How to use Gateway Client? | SAP Blogs

https://blogs.sap.com/2013/10/14/for-beginners-how-to-use-gateway-client/ 15/15

You might also like