I'm very new to odata4j.
I started with a simple Eclipse project which creates a consumer and tries to read the entities
public static void main(String[] args) {
// TODO Auto-generated method stub
// create consumer instance
ODataConsumer consumer = ODataConsumers.create(serviceUrl);
// list category names
for (OEntity category : consumer.getEntities("Categories").execute()) {
String categoryName = category.getProperty("Name", String.class).getValue();
System.out.println("Category name: " + categoryName);
}
}
Exception in thread "main" java.lang.RuntimeException: Expected status OK, found Moved Permanently. Server response:
at org.odata4j.jersey.consumer.ODataJerseyClient.doRequest(ODataJerseyClient.java:165)
at org.odata4j.consumer.AbstractODataClient.getMetadata(AbstractODataClient.java:43)
at org.odata4j.consumer.AbstractODataConsumer$CachedEdmDataServices.refreshDelegate(AbstractODataConsumer.java:212)
at org.odata4j.consumer.AbstractODataConsumer$CachedEdmDataServices.getDelegate(AbstractODataConsumer.java:205)
at org.odata4j.internal.EdmDataServicesDecorator.findEdmEntitySet(EdmDataServicesDecorator.java:46)
at org.odata4j.consumer.AbstractODataConsumer$CachedEdmDataServices.findEdmEntitySet(AbstractODataConsumer.java:221)
at org.odata4j.consumer.AbstractODataConsumer.getFeedCustomizationMapping(AbstractODataConsumer.java:235)
at org.odata4j.consumer.AbstractODataConsumer.getEntities(AbstractODataConsumer.java:73)
at org.odata4j.consumer.AbstractODataConsumer.getEntities(AbstractODataConsumer.java:69)
at Tester.main(Tester.java:15)
Caused by: org.odata4j.exceptions.UnsupportedMediaTypeException: Unknown content type text/html;charset=UTF-8
at org.odata4j.format.FormatParserFactory.getParser(FormatParserFactory.java:78)
at org.odata4j.jersey.consumer.ODataJerseyClient.doRequest(ODataJerseyClient.java:161)
... 9 more
Am I missing something? any hint is more than welcome.