Skip to Content
0
Feb 19, 2014 at 11:02 AM

Batch Update/Put on Gateway

84 Views

Dear Experts,

I am trying to implement the Batch Update/Put for a scenario where the UI is sending multiple records in the PUT scenario. The Back end API can take multiple records to process the scenario but since this is an update (PUT) /ServiceName/EntityTypeSet('Key'), gateway is not able to take these concurrent requests at the same time.

To achieve this, the batch update was implemented and the following steps were performed.

1. Redefinition of Changeset_Begin and Changeset_End

2. Calling the Batch URL (sample type) /ServiceName/$Batch with the CSRF token for Content Type - multipart/mixed; boundary=batch and the payload of the following sample type.

3. Calling the POST in the Rest Client to perform the batch.

--batch

Content-Type: multipart/mixed; boundary=changeset

--changeset

Content-Type: application/http

Content-Transfer-Encoding: binary

PUT EntitytypeSet(Key='XXXXXXXXXX') HTTP/1.1

Content-Type: application/atom+xml

Content-Length: 975

<atom:entry xmlns:atom="http://www.w3.org/2005/Atom" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">

<atom:content type="application/xml">

<m:properties>

</m:properties>

</atom:content>

</atom:entry>

--changeset

Content-Type: application/http

Content-Transfer-Encoding: binary

PUT EntitytypeSet(Key='XXXXXXXXXX') HTTP/1.1

Content-Type: application/atom+xml

Content-Length: 975

<atom:entry xmlns:atom="http://www.w3.org/2005/Atom" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">

<atom:content type="application/xml">

<m:properties>

</m:properties>

</atom:content>

</atom:entry>

--changeset--

--batch--

I get the below error on the Rest Client.

Could not get any response

This seems to be like an error connecting to https://--------------/TechnicalServiceName/$batch. The response status was 0.
Check out the W3C XMLHttpRequest Level 2 spec for more details about when this happens.

Please advise.

Thanks in Advance.

Br, Vivek