简体   繁体   English

Olingo4向后兼容吗?

[英]Is Olingo4 backward compatible?

If I use Olingo4 libraries at client side (java), would they be compatible with ODATA 2.x services? 如果我在客户端(java)使用Olingo4库,它们是否与ODATA 2.x服务兼容?

Thanks 谢谢

It may work in some trivial scenarios, but even a simple count option differs much for different OData versions: 它可能在某些琐碎的情况下有效,但是对于不同的OData版本,即使是简单的count选项也有很大不同:

  1. http://services.odata.org/V2/OData/OData.svc/Products/ ?$inlinecount=allpages&$format=json [v2] http://services.odata.org/V2/OData/OData.svc/Products/?$ inlinecount = allpages&$ format = json [v2]
  2. http://services.odata.org/V4/OData/OData.svc/Products ?$count=true&$format=json [v4] http://services.odata.org/V4/OData/OData.svc/Products?$ count = true&$ format = json [v4]

Official OData page suggests that Apache Olingo , odata4j and Jello Framework should have client implementations for OData 2. I've not worked with Olingo's client for v2, but I've heard it is very poor. OData官方页面建议Apache Olingoodata4jJello Framework应该具有OData 2的客户端实现。我没有使用Olingo的v2客户端,但是我听说它非常差。 And I couldn't find anything interesting from odata4j or Jello Framework (quick research). 而且我从odata4jJello Framework (快速研究)中找不到任何有趣的东西。

In the worst scenario, you can go with a standard HTTP client. 在最坏的情况下,您可以使用标准的HTTP客户端。 In the end, OData is based on REST. 最后,OData基于REST。

The short answer is no . 简短的答案是否定的

The long answer is, Olingo or any other library is just an implementation of the OData Protocol. 长的答案是,Olingo或任何其他库仅仅是OData协议的实现。 The version 4 of the protocol had breaking(read incompatible) changes, with the previous versions. 与先前版本相比,该协议的版本4具有重大更改(读取不兼容)。

You can check out this link to get a list of all changes, including the incompatible ones in OData 4. 您可以查看此链接以获取所有更改的列表,包括OData 4中不兼容的更改。

Now to be fully compatible, with both OData 2 and OData 4, you can read the OData-MaxVersion header sent by the client and based on it, you can send the response accordingly.This will require you to have both odata 2 and odata 4 implementations(using Olingo 2 and Olingo 4 or something else) running on your backend. 现在要与OData 2和OData 4完全兼容,您可以读取客户端发送的OData-MaxVersion标头并基于它发送响应,这将要求您同时拥有odata 2和odata 4在后端运行的实现(使用Olingo 2和Olingo 4或其他)。

On a personal note, if you are starting out today and don't have a strong reason to have two implementations, it's not mandatory for an OData v4 service to support a lower version client. 就个人而言,如果您今天刚开始并且没有充分的理由进行两种实现,那么OData v4服务不必须支持较低版本的客户端。

An OData 4 service may respond to V1-V3 clients with 4XX-level errors. OData 4服务可能会以4XX级错误响应V1-V3客户端。

http://docs.oasis-open.org/odata/odata/v4.0/errata02/os/complete/part1-protocol/odata-v4.0-errata02-os-part1-protocol-complete.html#_Toc406398370 http://docs.oasis-open.org/odata/odata/v4.0/errata02/os/complete/part1-protocol/odata-v4.0-errata02-os-part1-protocol-complete.html#_Toc406398370

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM