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,134

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
anirban_sengupta4
Participant
0 Likes

Hi,

I have resolved this myself with the inputs from Andre above. Would like to share the same.

There would have been one extra line feed between Content-Transfer-Encoding and the GET method.

Instead of writing as

Content-Transfer-Encoding: binary

GET PeopleSet(Id=1) HTTP/1.1

we should write as

Content-Transfer-Encoding: binary

<at least one "carriage return line feed">

GET PeopleSet(Id=1) HTTP/1.1

Below is the screenshot of the gateway client which is returning successful result (status code is 202)1.