tapvanvn / odata4j

Automatically exported from code.google.com/p/odata4j
0 stars 0 forks source link

odata4j 0.6 does not parse Microsoft azure market place data correctly #150

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. use 0data4j-0.6.0-bundle.jar
2. create a data consumer using the following code

consumer = ODataJerseyConsumers.dallas(serviceURL, accountKey, uuid); // old 
style still supported by azure

3. test this consumer with any of the public data sources in azure data market 
place and try to create an enumerable entity set and navigate the enumerable 
entity set 

What is the expected output? What do you see instead?

A sample error messsage is as follows:

java.lang.RuntimeException: java.lang.RuntimeException: Could not derive the 
entity-set for entry: 
https://api.datamarket.azure.com/Data.ashx/data.gov/Crimes/CityCrime(115856)
    at org.core4j.ReadOnlyIterator.hasNext(ReadOnlyIterator.java:50)
    at org.core4j.Enumerable$FuncIterator.hasNext(Enumerable.java:482)
    at org.core4j.Enumerable$FuncIterator.hasNext(Enumerable.java:482)

What version of the product are you using? On what operating system?

odata4j 0.6, Ubuntu
Please provide any additional information below.

Original issue reported on code.google.com by svirdhag...@gmail.com on 25 Mar 2012 at 1:02

GoogleCodeExporter commented 9 years ago
here is more trace that may be useful in debugging the problem

Caused by: java.lang.RuntimeException: Could not derive the entity-set for 
entry: 
https://api.datamarket.azure.com/Data.ashx/data.gov/Crimes/CityCrime(115856)
    at org.odata4j.format.xml.AtomFeedFormatParser.parseEntry(AtomFeedFormatParser.java:328)
    at org.odata4j.format.xml.AtomFeedFormatParser.parseFeed(AtomFeedFormatParser.java:155)
    at org.odata4j.format.xml.AtomFeedFormatParser.parse(AtomFeedFormatParser.java:143)
    at org.odata4j.format.xml.AtomFeedFormatParser.parse(AtomFeedFormatParser.java:41)
    at org.odata4j.jersey.consumer.ConsumerQueryEntitiesRequest$EntryIterator.advance(ConsumerQueryEntitiesRequest.java:81)
    at org.core4j.ReadOnlyIterator.hasNext(ReadOnlyIterator.java:48)

Original comment by svirdhag...@gmail.com on 25 Mar 2012 at 1:08

GoogleCodeExporter commented 9 years ago

Original comment by john.spurlock on 25 Mar 2012 at 8:21

GoogleCodeExporter commented 9 years ago
Working fine for me with 0.6.

    String url = "https://api.datamarket.azure.com/Data.ashx/data.gov/Crimes";
    OClientBehavior basicAuth = OClientBehaviors.basicAuth("accountKey", accountKey);
    ODataConsumer c = ODataJerseyConsumer.newBuilder(url).setClientBehaviors(basicAuth).build();
    System.out.println( c.getEntities("CityCrime").execute().take(100).toList());

Original comment by john.spurlock on 25 Mar 2012 at 9:22

GoogleCodeExporter commented 9 years ago
- I ran into the same issue with 0.6 when using the class ODataJerseyConsumer. 
I called the create ODataJerseyConsumer.create(url) method then, 
getEntities("/SampleCustomerData").execute().toList(); and I get the same error 
reported. 
- It worked when I used version 0.5, but using the ODataConsumer class instead, 
and didn't have to prefix the "SampleCustomerData" with the the '/'. 
- It is also too slow to be used in a real application (at least on Android 
2.3.3), both 0.5 or 0.6. I wonder if there are plans to address the performance 
issue.

Original comment by ned.nas...@gmail.com on 10 Jun 2012 at 9:43

GoogleCodeExporter commented 9 years ago
Ned, is your comment about Microsoft azure data market?  Please open a 
different bug if you are running into issues unrelated to data market.  I just 
retested data market access (data.gov) and it seems to be fine.

Original comment by john.spurlock on 17 Jun 2012 at 7:44

GoogleCodeExporter commented 9 years ago
The argument passing and the way of establishing consumers seems to have 
changed between earlier versions (0.3) and the current version. Before, one 
could supply any part of the URL that is ultimately generated to create the 
consumer and then provide the rest of the URL in the query spec provided to get 
entities. But, now, one needs to be careful based on which database one is 
trying to get data from in the Azure data market place. Not sure why this 
change was made as it reduces flexibility and uniform wrapping schemes cannot 
be applied. But, it does work for me with the new example in the example 
directory of the source distribution.

Original comment by svirdhag...@gmail.com on 17 Jun 2012 at 8:03

GoogleCodeExporter commented 9 years ago
Ok sounds good.  Feel free to suggest new consumer api enhancements to ease 
data market access as a separate issue - where you can provide more detail.

Or better yet, send a patch! : )

Original comment by john.spurlock on 17 Jun 2012 at 8:07

GoogleCodeExporter commented 9 years ago
thanks. Will start a new issue. You would not want me to patch !!

Original comment by svirdhag...@gmail.com on 17 Jun 2012 at 9:18