Problem Returning OData

88 views
Skip to first unread message

Techboy

unread,
Nov 1, 2010, 5:48:56 PM11/1/10
to odata4j-discuss
My code doesn't work:


------------------------------------------------------------------------------------------------------------------------------
public static Enumerable<OEntity> getUserInfo() {

ODataConsumer c = ODataConsumer.create("https://
odata.sqlazurelabs.com/OData.svc/v0.1/rp1uiewita/StackOverflow/");


return c.getEntities("Users").execute();
------------------------------------------------------------------------------------------------------------------------------


I think it is unable to access the URL
https://odata.sqlazurelabs.com/OData.svc/v0.1/rp1uiewita/StackOverflow/

Please can you tell me what I am doing wrong?

Thanks.

Craig Vyvial

unread,
Nov 2, 2010, 4:03:14 PM11/2/10
to odata4j-discuss
It may have just taken a really long time to get all the data.
If you add this line you will see more detail.

ODataConsumer.DUMP_REQUEST_HEADERS = true;

I made a simple example and it took a while to run.

public class StackoverflowConsumerExample extends BaseExample {
public static void main(String... args) {
ODataConsumer c = ODataConsumer.create("https://
odata.sqlazurelabs.com/OData.svc/v0.1/rp1uiewita/StackOverflow/");
ODataConsumer.DUMP_REQUEST_HEADERS = true;
Enumerable<OEntity> execute =
c.getEntities("Users").execute();
List<OEntity> toList = execute.toList();
for (OEntity oEntity : toList) {
for (OProperty<?> p : oEntity.getProperties()) {
report("%s: %s", p.getName(), p.getValue());
}
report("\n");
}
report("count: " + toList.size());
}
}

-Craig Vyvial

On Nov 1, 4:48 pm, Techboy <p...@performit.co.uk> wrote:
> My code doesn't work:
>
> --------------------------------------------------------------------------- ---------------------------------------------------
>     public static Enumerable<OEntity> getUserInfo() {
>
>         ODataConsumer c = ODataConsumer.create("https://
> odata.sqlazurelabs.com/OData.svc/v0.1/rp1uiewita/StackOverflow/");
>
> return c.getEntities("Users").execute();
> --------------------------------------------------------------------------- ---------------------------------------------------
>
> I think it is unable to access the URLhttps://odata.sqlazurelabs.com/OData.svc/v0.1/rp1uiewita/StackOverflow/

Paul Richardson

unread,
Nov 6, 2010, 8:29:45 PM11/6/10
to odata4j...@googlegroups.com
Thanks for the help.

I actually found out that it was because I was missing the security in the
manifest file:

<uses-permission
android:name="android.permission.INTERNET"></uses-permission>

After adding that it now works.

This is my first Android app :-)

Thanks.

Paul Richardson

Reply all
Reply to author
Forward
0 new messages