Quantcast
Channel: SCN : All Content - SAP Gateway
Viewing all articles
Browse latest Browse all 2823

Incomplete Respose for Batch Request

$
0
0

Folks,

We are using batch processing for some of our transactions (mainly write use-cases) and we are facing issues with the response of the $batch request when there's an error (business error) in one of the change sets. The issue with the response is that we don't get the response body after the first request that fails (HTTP 400/Bad Request), however, the response headers and the transaction completes successfully for the rest of the change sets. I have listed below a sample of the request and response to illustrate the issue that we are facing.

 

------------------------------------------------------------------------

Request:

--batch
Content-Type: multipart/mixed; boundary=changeset

--changeset
Content-Type: application/http
Content-Transfer-Encoding: binary

POST POSTQTYCollection HTTP/1.1
Content-Type: application/json
Content-Length:672

{<request body>}

--changeset--

--batch
Content-Type: multipart/mixed; boundary=changeset

--changeset
Content-Type: application/http
Content-Transfer-Encoding: binary

POST POSTQTYCollection HTTP/1.1
Content-Type: application/json
Content-Length:671

{<request body>}

--changeset--

--batch
Content-Type: multipart/mixed; boundary=changeset

--changeset
Content-Type: application/http
Content-Transfer-Encoding: binary

POST POSTQTYCollection HTTP/1.1
Content-Type: application/json
Content-Length:673

{<request body>}

--changeset--
--batch--

 

------------------------------------------------------------------------

Response:

--ejjeeffe0
Content-Type: multipart/mixed; boundary=ejjeeffe1
Content-Length:      1362

--ejjeeffe1
Content-Type: application/http
Content-Length: 1241
content-transfer-encoding: binary

HTTP/1.1 201 Created
Content-Type: application/atom+xml;type=entry
Content-Length: 1013
location: xxx/POSTQTYCollection('124557.1074')
dataserviceversion: 2.0

<RESPONSE BODY WITH ENTITY>


--ejjeeffe1--

--ejjeeffe0
Content-Type: application/http
Content-Length: 1211
content-transfer-encoding: binary

HTTP/1.1 400 Bad Request
Content-Type: application/xml
Content-Length: 1006
location: xxx/POSTQTYCollection('')
dataserviceversion: 1.0

<RESPONSE BODY WITH ERROR>


--ejjeeffe0
Content-Type: multipart/mixed; boundary=ejjeeffe1
Content-Length:       312

--ejjeeffe1
Content-Type: application/http
Content-Length: 192
content-transfer-encoding: binary

HTTP/1.1 201 Created
Content-Type: text/html
Content-Length: 0
location: xxx/POSTQTYCollection('')
dataserviceversion: 2.0

<NO RESPONSE BODY>


--ejjeeffe1--

--ejjeeffe0--

 

 

As you see, the last change set has a valid response (HTTP 201), however, the body of the response is not contained in the multipart response. The request is formatted correctly since the entire transaction works as expected; i.e. the first change set get committed, the second gets rolled back and the final one gets committed. However, the response body for the requests after the request that fails does is not sent by Gateway.

 

Does anyone know a solution for the same? We rely on the response of the CREATE to further processing and hence cannot rely just on the HTTP code to know that the CREATE was successful.

 

Thanks in advance,

Henry


Viewing all articles
Browse latest Browse all 2823

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>