Professional Documents
Culture Documents
| SAP Blogs
Products
Products Industries
Industries Support
Support Training
Training Community
Community Developer
Developer Partner
Partner About
About
Home / Community / Blogs + Actions
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
We consider the SAP delivered demo service /IWFND/RMTSAMPLEFLIGHT for our use cases.
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!
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 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’
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.
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.
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 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
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.
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
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
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 ).
Andre Fischer
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
Thanks Andre.
Hemendra Sabharwal
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
Thanks Krishna,
Regards,
Vishnu
Ke Li
Sara Zhang
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
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.
Siva
Juhi Bhatnagar
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
Thanks Krishna,
Adhimas Setianegara
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