views:

928

answers:

5

I have a java back-end that needs to expose services to clients running in the following environments :

  • J2ME
  • Windows Mobile
  • iPhone

I am looking for the best tool for each platform. I do not search a technology that works everywhere. I need something "light" adapted to low speed internet access.

Right now I am using SOAP. It is verbose and not easy to parse on the mobile... the problem is that I have not seen any real alternative.

Is there a format that works "out of the box" with one of these platforms ? I would rather not use a bloated library that will increase tremendously the download time of the application.

Everybody seems to agree on JSON. Does anyone has implemented a solution based on JSON running with Objective-C, J2ME, Windows Mobile ?

Note : so far the best solution seems to be Hessian. It works well on Windows Mobile and Objective-C/iPhone . The big problem is J2ME. The J2ME implementation of Hessian has serious limitations. It does not support complex objects... I had written another question about it. If you have any ideas, there are very welcome.

+7  A: 

JSON is fairly compact, and supported by most frameworks. You can transfer data over HTTP using standard REST techniques.

There are JSON libraries for Java, Objective C, and many other languages (scroll down). You should have no problem finding framework support on the server side, because JSON is used for web applications.

Older alternatives include plain XML and XML-RPC (like SOAP, but much simpler, and with libraries for most languages).

emk
Hum... Is there a simple way to parse JSON with J2ME/WindowsMobile/Cocoa ??
Alexandre Victoor
Well, the Java and Object C versions will work on J2ME and Cocoa. What language are you using with Windows Mobile? There's a half-dozen C++-based frameworks on the JSON site, listed down at the bottom of the page.
emk
+2  A: 

REST + XML or JSON would be a good alternative. It is making big strides in the RIA world and the beauty of it is in it's simplicity. It is very easy to use without needing any special tooling. SOAP has it's strong points, but it works best in an environment with strong tooling support for it. I'm guessing from your question that's not the case.

Russell Leggett
+1  A: 

How about plain old XML (somewhat unfortunately referred to as POX)?

Another very useful option would be JSON. There are libraries for every single programming language out there.

Possibly, since you are working in an environment that is constrained in terms of both computing and networking resources, and with a statically typed language, Google’s protocol buffers would be preferrable for you. (Just disregard the RPC crud in there; RPC is an attractive nuisance, not a useful technology.)

The problem with your question is that you haven’t provided a whole lot of context about what kind of data this is and what your use cases are, so it’s hard to speak in anything but very vague generalities.

Aristotle Pagaltzis
+4  A: 

Hessian. http://hessian.caucho.com. Implementations in multiple languages (including ObjC), super light weight, and doesn't require reliance on dom/xml parsers for translation from wire to object models. Once we found Hessian, we forgot we ever knew XML.

I agree hession is a wonderful product. However does it really apply here ? I have you tried hession in a J2ME environment ? iPhone or Windows Mobile ?
Alexandre Victoor
Thanks for your responseI have just seen that there are implementations for iPhone in ObjectiveC and j2me is mentionned in the hessian online documentation
Alexandre Victoor
+1  A: 

Seconding JSON. I ported the Stringtree JSON reader to J2ME. It's a single class JSON reader that compiles into a 5KB class file, and directly maps the JSON structure into native CLDC types like Hashtable and Vector. Now I can use the same server for both my desktop browser AJAX frontend and my J2ME client.

Carlos Carrasco