-
Notifications
You must be signed in to change notification settings - Fork 21
User guide (Engine)
There are some common basic concepts that need to be introduced before starting with ODataJClient.
URIs are a key concept in the OData protocol specification, so you should be already aware of the elements below (full reference to URI syntax is also available):
Many methods referenced below in the Examples section require an URI
parameter; with ODataJClient two options are available for this purpose:
- provide an
URI
value via plainString
:URI.create("http://services.odata.org/OData/OData.svc/Products")
; - feature the provided
ODataURIBuilder
- see the Examples below for some sample usage.
Working with ODataJClient can be generally summarized as:
- get an
ODataRequest
instance (for the required kind of request) via one of the provided Factory objects; - (optionally) use another Factory object to build the parameter(s) to pass to the request created above;
- execute the request and obtain a specialized
ODataResponse
instance (generally, at this point the actual REST communication with remote OData service takes place); - inspect the response object and read the body into one of Java classes built to represent the OData model objects (entity, entity set, property, and so on - read more about OData abstract data model).
ODataJClient supports two serialization formats for OData model objects:
- Atom / XML
-
application/atom+xml
(for Entity and Entity Set) -
application/xml
(for any other model object) - JSON, in its three variants
- No Metadata
application/json;odatda=nometadata
- Minimal Metadata
application/json
orapplication/json;odatda=minimalmetadata
- Full Metadata
application/json;odatda=fullmetadata
Any ODataRequest
object allows the content format to be specified; when not specified, application/json;odatda=fullmetadata
is the default set.
In the following, let testODataServiceRootURL
be the String
representation of your OData service root (http://services.odata.org/OData/OData.svc/
for example).