I want to extract all the promotions from the odata service using Java application. I am using the API jar as Odata4j-core and used CoreOdataJerseyConsumer to consume the service. I can access the Publications using the below code snippet
OdataConsumer consumer=OdataJerseyConsumer.create(enddpointURI);
client.getEntities("Publications").filter("Title eq 'Chrome Promotion'").execute().first().getProperty("Id",Integer.class).getValue();
I can view all the promotions in the browser just requesting the /odata.svc/Promotions url. But when it comes to fetch those in the java application, I am not able to get those.
UPDATED
For endpoint url I am using the odata service , that has been installed. "http://domainname/projectname/ws/odata.svc/" .
For promotions I am using the below code snippet
client.getEntities("Promotions").execute() .
The error logs ::
at java.lang.Thread.run(Thread.java:745) [na:1.7.0_55] java.lang.IllegalArgumentException: type cannot be null at org.odata4j.edm.EdmDataServices.getEdmEntitySet(EdmDataServices.java:60) at org.odata4j.internal.EdmDataServicesDecorator.getEdmEntitySet(EdmDataServicesDecorator.java:41) at org.odata4j.format.xml.AtomFeedFormatParser.parseEntry(AtomFeedFormatParser.java:367) at org.odata4j.format.xml.AtomFeedFormatParser.parseFeed(AtomFeedFormatParser.java:169) at org.odata4j.format.xml.AtomFeedFormatParser.parse(AtomFeedFormatParser.java:157) at org.odata4j.format.xml.AtomFeedFormatParser.parse(AtomFeedFormatParser.java:45) at org.odata4j.consumer.ConsumerQueryEntitiesRequest.doRequest(ConsumerQueryEntitiesRequest.java:67) at org.odata4j.consumer.ConsumerQueryEntitiesRequest.getEntries(ConsumerQueryEntitiesRequest.java:50) at org.odata4j.consumer.ConsumerQueryEntitiesRequest.execute(ConsumerQueryEntitiesRequest.java:40) at com.cde.apps.pagedirectory.PageDirectoryController.getSiteNodes(PageDirectoryController.java:75)