You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@olingo.apache.org by Volker Jordan <jo...@ffm-one.com> on 2017/05/17 05:22:13 UTC

ODataV4 client sample

Hi,

I need some help.

Is there a simple ODataV4 client sample.
‎
I am still not able to get any entities.

String serviceUrl = 
"http://192.168.100.224:8003/ODataServer/ODataAccess.xsodata";
ODataClient oClient=ODataClientFactory.getClient();
oClient.getConfiguration().setHttpClientFactory(new 
BasicAuthHttpClientFactory("xxx", "xxx"));
URI eventUri = 
oClient.newURIBuilder(serviceUrl).appendEntitySetSegment("Event").build();
ODataRetrieveResponse<ClientEntitySetIterator<ClientEntitySet, 
ClientEntity>> oResponse = 
oClient.getRetrieveRequestFactory().getEntitySetIteratorRequest(eventUri).execute();
ClientEntitySetIterator<ClientEntitySet, ClientEntity> 
eIterator = oResponse.getBody();

The iterator is always null even though I see that the response provided 
data.

Also a single entity is not possible

ODataRetrieveResponse<ClientEntity> 
eResponse=oClient.getRetrieveRequestFactory().getEntityRequest(entityUri).execute();

Regards
Volker