I can't get Batch request to work with ADO.NET Data Services, needhelp

B

bart

http://wiibart.posterous.com/i-cant-get-batch-request-to-work-with-adonet

We are using a ADO.NET REST service and it does not allow to update a
record with many related records like a customer with orders or a
playlist with its items.

To avoid too many http requests I decided to look at ADO.NET batch
requests.

But after a day of testing and googling I have not made any batch
update yet, I did get a lot of unhelpful errors. The examples in the
documentation don't help much either and are also not very clear I
must say.

When I use following headers I get an 400 response with error JSON
format as shown below;




MIME-Version: 1.0
Content-Type: multipart/mixed; boundary=batch(c8660a87-b5d3-40c3-ac52-
bdeff069231e)
Accept: application/json

{
"error": {
"code": "", "message": {
"lang": "nl-NL", "value": "Media type requires a \';\' character
before a parameter definition."
}
}
}

So I searched the Internet and found some examples that specify the
boundary different, so I tried;

MIME-Version: 1.0
Content-Type: multipart/mixed; boundary=batch_c8660a87-b5d3-40c3-ac52-
bdeff069231e
Accept: application/json

Now I get this 202 response (in xml)

<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<error xmlns="http://schemas.microsoft.com/ado/2007/08/dataservices/
metadata">
<code></code>
<message xml:lang="nl-NL">The boundary delimiter ' --batch_c8660a87-
b5d3-40c3-ac52-bdeff069231e' is not valid. Please specify a valid
boundary delimiter or make sure that the content length specified is
correct.</message>
</error>
--batchresponse_ad73de2c-21dd-47c4-84ed-007aecb447db--

It seems like the boundary delimiter in de body is wrong, I have the
body set like this;

--batch_c8660a87-b5d3-40c3-ac52-bdeff069231e
Content-Type: multipart/mixed; boundary=changeset_77162fcd-b8da-41ac-
a9f8-9357efbbd621

--changeset_77162fcd-b8da-41ac-a9f8-9357efbbd621
Content-Type: application/http
Content-Transfer-Encoding: binary

MERGE /PlaylistItem(272L) HTTP/1.1
Content-Type: application/atom+xml;type=entry

{ SortOrder: 1 }

--changeset_77162fcd-b8da-41ac-a9f8-9357efbbd621--

--batch_c8660a87-b5d3-40c3-ac52-bdeff069231e--


So I'm lost, and by posting this article I hope someone can help me,
and with that help others. You can comment on this article using your
Twitter credentials using OAUTH

Thanks,

Bart
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top