In my previous post I discussed web 2.0 in LWUIT but I didn't discuss how easy it really is. A friend brought it to my attention that most people don't know how to access a web service in Java ME or not aware of all the tools in the field.
Maybe I'm not aware of some tools too? If I missed something please point it out in the comments.
1. JSR 172 implements support for web service access on a device. I am not a fan of the SOAP/WSDL based web services, which this JSR supports. I can't recommend it because I'm not a fan of such web services and think that bringing SOAP to the device is not a bright idea (remarkably verbose protocol).
2. Web To Mobile Client in NetBeans - we use this allot (I was on the initial team to author this so I'm not objective). Some of its features are flaky (new version is a rewrite so don't blame me), I opened bugs in the NB bugtracking tool for this. It requires Netbeans, but the idea is very powerful and the use case is so simple that this alone is worth an IDE switch (did I mention I wasn't objective?).
You just define a server class in a WAR (web application) project and run the wizard (in the Java Mobile project) which will generate client side proxy code to invoke the server functionality and generate a servlet to intercept client calls. The protocol is binary and very efficient and you have the full source code for the protocol. If you need to change something (add a method to the API etc...) just rerun the wizard. There is no API involved or external jars.
This is essentially RMI for mobile development, but much more efficient. Serializing objects in this tool is where most of the issues and limitations exist, currently I am only able to work with simple structs whose fields are public (this should be fixed in the next version of NB mobility).
The documentation for anything beyond the basic features was never updated since our first version, there is very little information beyond simple demos on the web.
3. Just started playing with the mobile ajax project from the embedded commuity which is pretty sweet and geared at REST which is much better than web services (all major sites expose REST API's).
I've have some issues with Nokia S40 using this API at the moment, but this is something that is actively developed so I'm sure it will be fixed. The license is BSD so its pretty easy to embed this to anything.