androidwcfodataodata4j

getEntity call results in crash (using odata4j on a WCF service)


I am trying out odata4j in my android app to retrieve data from a DB that can be accessed from a WCF service.

 ODataConsumer co = ODataConsumer.create("http://xxx.xx.xx.xxx:xxxx/Users");
 for(OEntity user : co.getEntities("Users").execute())
 {
      // do stuff
 }

However this crashes at the call to getEntities. I have tried a variety of other calls as well, such as

 Enumerable<OEntity> eo = co.getEntities("Users").execute();            
 OEntity users = eo.elementAt(0);

However this also crashes at eo.elementAt(0).

The logcat doesn't tell me anything, and the callstack seems to be Suspended at ActivityThread.performLaunchActivity.

Entering "http://localhost:xxxx/Users" in my web browser on the other hand works as expected and returns the users in my DB in xml format.

Any ideas on how I can debug this?


Solution

  • I guess the call should be:

    ODataConsumer co = ODataConsumer.create("http://xxx.xx.xx.xxx:xxxx");
    for(OEntity user : co.getEntities("Users").execute())
    {
         // do stuff
    }
    

    create defines service you want to connect but Users is the resource you want to query.