How to debug the code of odata services
I have written the code of "Read Service" in the Get_Entity method from the below link Let’s code CRUDQ and Function Import operations in OData service! but I want to debug the code.
I want to know the technique to debug the code to see which data is coming when and where. Because I am not able to do the read service operation.
Kindly help me to debug the code.
You can directly try with transaction /IWFND/GW_CLIENT also known as Gateway Client.
Or if you are familiar with service builder, You need to go to Service Maintenance node, then you need to click on the Maintain Service button. A new screen will popup . There you can see a button for Gateway Client.
This is a test client provided by Gateway to simulate browser behaviour. Using this client you can directly call your OData service and check the result.
To Debug a READ
1. you need to set a session breakpoint in method GET_ENTITY of your Data Provider class,
2. Next you need to to call the READ URL with HTTP method 'GET' in the Gateway Client. The READ URI will look like
/sap/opu/odata/IWBEP/<SERVICE NAME>/ENTITYSETNAME(KEY1=value1, KEY2= value2 )
If everything is fine so far , control will hit the break point.
Also you can use chrome extension like Postman or Advanced Rest Client to test your OData service.
The Advantage of Gateway Rest Client over these browser extension is , you do not need to pass X-CSRF-Token for PUT-POST-DELETE kind of operations, Gateway Client can take of these out of the box.