首页 > 解决方案 > 使用 ODataQueryBuilder 或 VDM 的 OData $batch 请求

问题描述

有没有办法使用 ODataQueryBuilder 或 VDM 生成的类发送 OData 批处理请求?

例子:

假设我正在使用 Northwind 公共 OData 服务 ( https://services.odata.org/V2/Northwind/Northwind.svc/ )

由于网络性能的原因,我想在一个请求中查询客户、类别和区域,如下所示:

网址:https ://services.odata.org/V2/Northwind/Northwind.svc/ $batch

--batch_8008-578f-c3c1
Content-Type: application/http
Content-Transfer-Encoding: binary

GET Customers HTTP/1.1
Accept: application/json
Accept-Language: en
DataServiceVersion: 2.0
MaxDataServiceVersion: 2.0


--batch_8008-578f-c3c1
Content-Type: application/http
Content-Transfer-Encoding: binary

GET Categories HTTP/1.1
Accept: application/json
Accept-Language: en
DataServiceVersion: 2.0
MaxDataServiceVersion: 2.0


--batch_8008-578f-c3c1
Content-Type: application/http
Content-Transfer-Encoding: binary

GET Regions HTTP/1.1
Accept: application/json
Accept-Language: en
DataServiceVersion: 2.0
MaxDataServiceVersion: 2.0


--batch_8008-578f-c3c1--

(我在 Postman 中对此进行了测试,它有效。)

我在其他场景中这将非常有用,例如一次读取多个单独的条目,发送 ChangeSet 以更改“事务”中的多个条目,以及调用函数导入。

标签: s4sdk

解决方案


此功能尚不支持,但当然完全有效。一旦有关于此问题的更新,我们将更新此问题。


推荐阅读