2

I'm looking to develop a blackberry application to consume a RESTful service. At the moment we plan to develop a REST layer which we will use to perform searches on a back end database and return the results as JSON.

I have used the Jersey framework ( http://jersey.java.net/ ) for consuming (and developing) REST layers in the past.

This is the first time we plan to develop such an app for a blackberry. From looking around I'm not sure if jersey is supported on the blackberry for consuming RESTful services.

So I'm wondering could someone offer some advice (on jersey or any other purpose built JARs) for using RESTful services on Blackberry? Otherwise we will have to build from scratch the code for consuming the RESTFul service. Or even use SOAP which I prefer not to have to do if possible.

Thanks, John

John
  • 371
  • 1
  • 4
  • 5

1 Answers1

2

Take a look at the JSON.org website, they have lib in Java to parse JSON data(I'v manage to make it work for BlackBerry without to much modifications.

The only thing left to do is a connection to the web service by passing the parameter you need to it. And then parse the response with the JSON lib to rebuild your data model in your native client.

And please don't use SOAP for mobile application.

Please read RIM doc for socket

You can use a httpConnection too

Michael B.
  • 3,410
  • 1
  • 21
  • 32
  • So I should be able to add in the josn.org jar for handling the JSON straight into my blackberry project in eclipse -jde for handling the json. As for the REST your open a socket connections (through either HTTP or HTTPS) and generate the equivalent REST call (PUT/POST/GET etc) by hand. Are there no libaries such as the jersey client libary for doing the calls? If I use the socket approach then when I do a search, I should extract the response string (which contains the search results as JSON) and then parse this response string (which will have the JSON) using the relevant jar from JSON.org – John Jun 10 '11 at 10:59
  • What sort of modifications did you need to make to use JSON.org jar work on the blackberry? – John Jun 10 '11 at 11:02
  • Could you please give reasons why socket is better than http in this case? – Vit Khudenko Jun 10 '11 at 17:27
  • @Arhimed in fact http would be a better fit. It's just that I found this link first. I will add the link to the http one. – Michael B. Jun 10 '11 at 17:33
  • @John, use the source, not the jar, you will have to compile it in the project directly, or make another project and use it has a library. – Michael B. Jun 10 '11 at 17:36