0

I have a WCF RESTful application I wrote based off of WcfRestContrib and hosting in iis7.5, which passes a pdf as a byte[]. I'm trying to figure out how, and what the best way would be, to consume this service in an Android application. I believe I took care of all the Java/WCF interop issues because the service is used by an outside company that uses java. But I don't see to many examples out there. I've read that I'm going to have to make a method that passes JSON instead XML, but otherwise I believe it should be usable for an Android app. I'm not seeing too many examples of Android apps that consume RESTful services, is this not the preferred method for Android?

I seen a couple articles (http://romenlaw.blogspot.com/2008/08/consuming-web-services-from-android.html) but most seem kind of old, though they still may be useful. I'm just curious how any experts out there would suggest I handle such a project, I can create another kind of service if need be. I just want to be able to load pdf's from a service based on some parameters. Security is a concern, but not mandatory at this stage. Service currently uses basic auth and is on a https.

Any thoughts? Suggestions?

Precious Roy
  • 1,086
  • 1
  • 9
  • 19

1 Answers1

0

While also adressing your security concernt, you could use an HttpsURLConnection and then use getInputStream() from that to put it in a bytearray using read().

Kurtis Nusbaum
  • 30,445
  • 13
  • 78
  • 102
  • I see what you're suggesting, I'm just not very familiar with java yet. I really need to build from example on the Android side, as I become more familiar with Eclipse. But you think that the service will suffice for an Android project? – Precious Roy Oct 21 '11 at 13:27
  • Yea, it should be just fine. There's enough components in android to put something together that will interact succesfully with your web service. Alot of the networking stuff in android was built with REST in mind. REST is what google is all about with their webapps. – Kurtis Nusbaum Oct 21 '11 at 16:15
  • That's what I figured, thinking REST would be the way to go since they promote the technology. I just don't see any examples to build from really. Since I'm somewhat new to Java even, it would be nice to see something similar. – Precious Roy Oct 24 '11 at 18:08
  • This is one of my favorite videos from Google I/O to watch: http://www.youtube.com/watch?v=xHXn3Kg2IQE . It talks at a high level how to develope RESTful apps for android. It should give a great starting point. – Kurtis Nusbaum Oct 24 '11 at 18:15
  • Wow, very good video. this is what I'm looking for, as far as becoming familiar with best practices on Android. There's a lot to consider conceptually. – Precious Roy Oct 24 '11 at 18:43