Friday, July 3, 2009

A Napkin Sketch

In the spirit of a late-night supper conversation, I'll sketch out the architecture of an all-Java MIDP-based photo-blogging application, starting from the client and progressing back to the blog server.

On the client end, you'll need a device that has a camera and supports video capture from the camera via MMAPI. The Nokia 3650 is one such device. More information about using MMAPI for video capture is in the article "Taking Pictures with MMAPI."

Once you capture an image on the device, it's straightforward to send the bits to a server. Chances are good, though, that you won't want to have the MIDlet talk to the blog server directly, for several reasons:

  • The MIDlet would need to use XML-RPC to converse with the server, which means that it would need to generate and parse XML. There is a variety of solutions to this problem, ranging from using a generalized parser and generator to hardcoding most of the XML and filling in the blanks at runtime. Either solution, however, may be heavier than you want in a MIDlet, which needs to respect the constraints of a mobile device. You can simplify the client by having it send images to an intermediate server using a simple protocol, then have the intermediate server talk XML-RPC to the blog server.
  • Even if you bit the bullet and included XML generating and parsing in your MIDlet somehow, you would still face the question of which API to support. To create a general solution, you'd want to support two or three of the most popular blog server APIs, which would entail even more code in the MIDlet. Again, moving all the blog server interaction onto an intermediate server would solve this problem.
  • Your application might well have a second market: users who don't have a blog, yet want a place to go look at pictures they've taken. The intermediate server could meet their needs as well as those of your blogging users.

In the future, J2ME phones that support JSR 172, the J2ME Web Services Specification, will have most of the overhead of generating and parsing XML messages built into the phone.

No comments:

Post a Comment