Reputation: 2983
If I use Olingo4 libraries at client side (java), would they be compatible with ODATA 2.x services?
Thanks
Upvotes: 0
Views: 586
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.
Upvotes: 1
Reputation: 791
It may work in some trivial scenarios, but even a simple count
option differs much for different OData versions:
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