Tintin
Tintin

Reputation: 2983

Is Olingo4 backward compatible?

If I use Olingo4 libraries at client side (java), would they be compatible with ODATA 2.x services?

Thanks

Upvotes: 0

Views: 586

Answers (2)

Shiva
Shiva

Reputation: 6885

The short answer is no.

The long answer is, Olingo or any other library is just an implementation of the OData Protocol. The version 4 of the protocol had breaking(read incompatible) changes, with the previous versions.

You can check out this link to get a list of all changes, including the incompatible ones in 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.

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.

An OData 4 service may respond to V1-V3 clients with 4XX-level errors.

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

Upvotes: 1

mat3e
mat3e

Reputation: 791

It may work in some trivial scenarios, but even a simple count option differs much for different OData versions:

  1. 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]

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. And I couldn't find anything interesting from odata4j or Jello Framework (quick research).

In the worst scenario, you can go with a standard HTTP client. In the end, OData is based on REST.

Upvotes: 1

Related Questions