0
votes

I am using Syncfusion's tools for scheduling. The scheduler is talking to an odata endpoint. The odata services are running correctly for get, put, delete. However, the scheduler uses the $batch to process edits to the schedule. I am unable to get the $batch to route and/or process correctly.

By default the scheduler is making the edit call like this:

https://localhost:44341/odata/Events/$batch

Here are my route maps:

app.UseMvc(builder =>
        {
            builder.Select().Expand().Filter().OrderBy().MaxTop(100).Count();
            builder.MapODataServiceRoute("odata", "odata", GetEdmModel());
            builder.MapODataServiceRoute("odataBatch", "odata/{controller}", GetEdmModel(), new DefaultODataBatchHandler());

        });

So I am getting a successful (200) POST in my headers but the response is a 404. I am very confused as to what is occuring. It seems like the controller is not processing the batch commands. Specifically the POST and PATCH commands in the payload body. Thanks in advance for your help.

In the dev tools (CHROME) this is what I am seeing:

RESPONSE TAB

--batchresponse_e2f02110-21b6-4559-924e-1e2b3376fb3c Content-Type: multipart/mixed; boundary=changesetresponse_4799e072-83d9-4b7d-9409-23eceb98736b

--changesetresponse_4799e072-83d9-4b7d-9409-23eceb98736b Content-Type: application/http Content-Transfer-Encoding: binary Content-ID: 0

HTTP/1.1 404 Not Found

--changesetresponse_4799e072-83d9-4b7d-9409-23eceb98736b-- --batchresponse_e2f02110-21b6-4559-924e-1e2b3376fb3c--

HEADERS TAB

General

Request URL: https://localhost:44341/odata/Events/$batch

Request Method: POST

Status Code: 200

Remote Address: [::1]:44341

Referrer Policy: no-referrer-when-downgrade

Response Header

access-control-allow-origin: https://localhost:44308

content-type: multipart/mixed;boundary=batchresponse_e2f02110-21b6-4559-924e-1e2b3376fb3c

date: Wed, 12 Jun 2019 21:35:08 GMT

odata-version: 4.0

server: Kestrel

status: 200

x-powered-by: ASP.NET

x-sourcefiles: =?UTF-8?B?QzpcVlMyMDE3IFByb2plY3RzXFRIUFRPZGF0YVxPZGF0YUxlYXJuaW5nXG9kYXRhXEV2ZW50c1wkYmF0Y2g=?=

Request Header

Provisional headers are shown

Accept: application/json, text/javascript, /; q=0.01

Content-Type: multipart/mixed; charset=UTF-8;boundary=batch_80a929c5-2918-463e-ba41-aa8c981ffb3b

DNT: 1

Origin: https://localhost:44308

Prefer: return=representation

Referer: https://localhost:44308/admin/home/scheduler

User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 Safari/537.36

Request Payload

--batch_80a929c5-2918-463e-ba41-aa8c981ffb3b Content-Type: multipart/mixed; boundary=changeset_f9c22042-3196-4452-a1c6-2fd55993e2a2

--changeset_f9c22042-3196-4452-a1c6-2fd55993e2a2 Content-Type: application/http Content-Transfer-Encoding: binary

POST null HTTP/1.1 Accept: application/json, text/javascript, /; q=0.01 Content-Id: 0 Content-Type: application/json; charset=utf-8

{"Id":2,"Subject":"Joe's Pizza Shack","StartTime":"2019-06-09T02:00:00.000Z","EndTime":"2019-06-09T07:30:00.000Z","StartTimezone":"America/New_York","EndTimezone":"America/New_York","Location":"123 Somewhere ,Longwood,FL 32750","Description":"asdfadfada","IsAllDay":false,"IsRecurring":true,"RecurrenceID":1,"RecurrenceRule":"FREQ=WEEKLY;BYDAY=SA;INTERVAL=1;","RecurrenceException":null,"IsReadonly":false,"IsBlock":false,"IsActive":true,"IsDisabled":false,"VenueId":1,"Guid":"4a0d1282-678b-b4b8-e84a-0cbb011887d4"}

--changeset_f9c22042-3196-4452-a1c6-2fd55993e2a2 Content-Type: application/http Content-Transfer-Encoding: binary

PATCH https://localhost:44341/odata/Events(1) HTTP/1.1 Accept: application/json, text/javascript, /; q=0.01 Content-Id: 1 Content-Type: application/json; charset=utf-8

{"Id":1,"Subject":"Joe's Pizza Shack","StartTime":"2019-06-09T02:00:00.000Z","EndTime":"2019-06-09T07:30:00.000Z","StartTimezone":"America/New_York","EndTimezone":"America/New_York","Location":"123 Somewhere ,Longwood,FL 32750","Description":"adgadgadfafdas","IsAllDay":false,"IsRecurring":true,"RecurrenceID":null,"RecurrenceRule":"FREQ=WEEKLY;BYDAY=SA;INTERVAL=1;","RecurrenceException":"20190609T020000Z","IsReadonly":false,"IsBlock":false,"IsActive":true,"IsDisabled":false,"VenueId":1}

--changeset_f9c22042-3196-4452-a1c6-2fd55993e2a2-- --batch_80a929c5-2918-463e-ba41-aa8c981ffb3b--

1

1 Answers

0
votes

found the problem.

It was in the payload.

POST null HTTP/1.1 Accept: application/json, text/javascript, /; q=0.01 Content-Id: 0 Content-Type: application/json; charset=utf-8

cant have a null value where you need to POST. Checked the datamanger and I had forgotten to configure the insertUrl.