cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

$batch ODATA GET request - Multipart document not valid

anirban_sengupta4
Participant
0 Likes
3,176

Dear Experts,

In order to learn $batch for ODATA, I have created a simple database table named ZODATABAT_PEOPLE which only contain the following fields as showing in the below screenshot:

I have also created the ODATA service and have generated and registered the service. Then I have extended the relevant methods for CREATE, GET_ENTITY and GET_ENTITYSET methods of the DPC_EXT class. From GW client, the service is working perfectly for both GET and POST methods. For POST, it is working for individual data insertion.

However, while I am trying to use POST method and using $batch to view the data, I am getting the error "In the context of Data Services an unknown internal server error occurred".

Here is what I am doing:

And I am getting the 500 Internal Server Error. Error log is showing Exception of type CX_SY_REF_IS_INITIAL has occurred.

My call stack as viewed from the error log is as follows:

While following the Call Stack from Error Log and debugging, I have come across the method /IWCOR/IF_REST_MP_ENTITY~GET_ENTITIES of class /IWCOR/CL_REST_BASE_ENTITY where the execution is going to line no. 12 where LO_ENTITY is initial. Referring to the comments that the multipart is not a valid document, I am not sure where I am going wrong.

And that is why null pointer exception is getting raised at line no. 33 as LO_ENTITY is getting returned as NULL from the method IO_REQUEST_ENTITY->GET_ENTITIES( ) at line no. 29.

I request your valuable inputs to guide me in this regard as to why the multipart document is not a valid document as per the comments in the GET_ENTITIES method in the previous screenshot.

Thanks and regards,

Anirban Sengupta

View Entire Topic
Andre_Fischer
Product and Topic Expert
Product and Topic Expert
0 Likes

Your request does not have the correct Format.

Please have a look at the CORE_SAMPLES that can be generated within the SAP Gateway Client as described here:

https://blogs.sap.com/2013/06/21/demo-test-cases/

The payload of a valid GET request looks like shown below.

So your request is missing the last line

--batch_001--

Here is a sample request from the CORE_SAMPLES

--batch
Content-Type: application/http
Content-Transfer-Encoding: binary
GET Conversions(Id='0002') HTTP/1.1

--batch--