yhknight / odata4j

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

odata4j-clientbundle-0.4.jar and Android below API level 10 #59

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Use odata4j on Android devices running an API Level below than level 10 
(Android 2.2 and below)
2. Calling Enumerable<?>.toList() results in an Exception

Please provide any additional information below.

Hi!

We just used the odata4j-clientbundle-0.4.jar library in an Android project 
against a SAP gateway and it worked fine except for one thing:

The project compiles fine using Android API level 4 (Android 1.6), but it 
doesn't work right using any API level 10. So, Android 2.3 and up work fine, 
all other versions don't.

The Exception we catch tells us, that you expect the HTTP response code to be 
200, but you received -1.

Somehow it seems to me that differences in the HTTP client libraries which are 
shiped with Android itself are causing this problem.

I can't give you a stack trace right now due to other communication problems to 
our SAP system, but I will attach it to this issue as soon as I can, maybe 
already tommorrow.

Please have a look into this issue and feel free to ask me for every 
information you might need additionally.

Regards,
Michael Risthaus

Original issue reported on code.google.com by mristhaus on 1 Sep 2011 at 3:01

GoogleCodeExporter commented 9 years ago
Please clarify as much as you can, and attach additional info so we can take a 
look.

iirc 0.4 was tested on a 2.2 droid + galaxy tab 7in (api level 8 aka froyo)

Original comment by john.spurlock on 1 Sep 2011 at 3:47

GoogleCodeExporter commented 9 years ago
Hi,

sorry that it took so long but now I'm able to provide a stacktrace.

If I use the odata4j-clientbundle-0.4.jar and execute my App on a Android 2.3 
device, everything's fine. All other Android versions (2.2 and below) throw the 
following exception:

10-06 11:55:55.185: DEBUG/InvSupport(361): 
net.atos.android.eplus.invsupport.comm.exception.ReadShopException: 
java.lang.RuntimeException: java.lang.RuntimeException: Expected status 200, 
found -1:
10-06 11:55:55.185: DEBUG/InvSupport(361):     at 
net.atos.android.eplus.invsupport.comm.Comm.getShopsForMerchant(Comm.java:185)
10-06 11:55:55.185: DEBUG/InvSupport(361):     at 
net.atos.android.eplus.invsupport.LoginActivity$6.run(LoginActivity.java:210)
10-06 11:55:55.185: DEBUG/InvSupport(361):     at 
java.lang.Thread.run(Thread.java:1096)
10-06 11:55:55.185: DEBUG/InvSupport(361): Caused by: 
java.lang.RuntimeException: java.lang.RuntimeException: Expected status 200, 
found -1:
10-06 11:55:55.185: DEBUG/InvSupport(361):     at 
org.core4j.ReadOnlyIterator.hasNext(ReadOnlyIterator.java:49)
10-06 11:55:55.185: DEBUG/InvSupport(361):     at 
org.core4j.Enumerable$FuncIterator.hasNext(Enumerable.java:487)
10-06 11:55:55.185: DEBUG/InvSupport(361):     at 
org.core4j.Enumerable$FuncIterator.hasNext(Enumerable.java:487)
10-06 11:55:55.185: DEBUG/InvSupport(361):     at 
net.atos.android.eplus.invsupport.comm.Comm.getShopsForMerchant(Comm.java:160)
10-06 11:55:55.185: DEBUG/InvSupport(361):     ... 2 more
10-06 11:55:55.185: DEBUG/InvSupport(361): Caused by: 
java.lang.RuntimeException: Expected status 200, found -1:
10-06 11:55:55.185: DEBUG/InvSupport(361):     at 
org.odata4j.consumer.ODataClient.doRequest(ODataClient.java:191)
10-06 11:55:55.185: DEBUG/InvSupport(361):     at 
org.odata4j.consumer.ODataClient.getEntities(ODataClient.java:87)
10-06 11:55:55.185: DEBUG/InvSupport(361):     at 
org.odata4j.consumer.OQueryRequestImpl$EntryIterator.advance(OQueryRequestImpl.j
ava:184)
10-06 11:55:55.185: DEBUG/InvSupport(361):     at 
org.core4j.ReadOnlyIterator.hasNext(ReadOnlyIterator.java:47)
10-06 11:55:55.185: DEBUG/InvSupport(361):     ... 5 more

Regards,
Michael

Original comment by mristhaus on 6 Oct 2011 at 9:54

GoogleCodeExporter commented 9 years ago
The problem also exists using a fresh checked out 0.5-snapshot version of 
odata4j.

Original comment by mristhaus on 6 Oct 2011 at 12:01

GoogleCodeExporter commented 9 years ago
Hi,

here is some additional information for you. I just did the request using 
ODataConsumer.dump.requestHeaders(true), 
ODataConsumer.dump.responseHeaders(true) and 
ODataConsumer.dump.responseBody(true). I used an Android API Level 8 emulator. 
Please find attached the log which was provided by logcat.

Regards,
Michael

Original comment by mristhaus on 12 Oct 2011 at 7:24

Attachments:

GoogleCodeExporter commented 9 years ago
I'm not able to reproduce using our sample android app.  However, these are all 
http endpoints, not https.

I suspect it has something to do with your ssl setup.  Give me an https odata 
url (or username/password) for testing and I'll be happy to dig further.

Original comment by john.spurlock on 12 Oct 2011 at 11:49

GoogleCodeExporter commented 9 years ago
Hi,

sorry that it took so long for me to answer.

The odata service causing this problem provides confidential data so I was not 
able to provide you acces to this service.

However, in the meantime we created another SAP gateway example project where 
we ran into the same issue.

For this service, we can give you the URL without any problems, and here it is:

https://palma-pp.eplus.de/sap/opu/sdata/sap/Z_ATOS_GENRES_SERVICE/

The only Behaviour used is the AllowSelfSignedCertsBehavior. I used odata4j 0.5.

Please find attached a log file snipplet, which contains the same exceptions as 
mentioned above.

Regards,
Michael

Original comment by mristhaus on 5 Dec 2011 at 8:51

Attachments:

GoogleCodeExporter commented 9 years ago
Thanks for sharing the test url.  I've verified that in odata4j 0.5:
 1. SSL works for non-self-signed certs on froyo 2.2:  e.g. https://odata4j-sample.appspot.com/datastore.svc/
 2. SSL works for self-signed certs on ICS 4.0: e.g. your url works in 4.0

However, your url doesn't work in froyo.  Can you run your site with a non 
self-signed cert or upgrade your clients?

Original comment by john.spurlock on 18 Dec 2011 at 7:59

GoogleCodeExporter commented 9 years ago
Hello, I had the same problem with Odata4j on android. So, I downloaded Core4j 
from 
(https://code.google.com/p/core4j/downloads/detail?name=core4j-0.4-archive.zip&c
an=2&q=) and then my problem was fixed.

Original comment by sergioas...@gmail.com on 19 Oct 2013 at 4:31