Tuesday, June 14, 2005

Y! Local Search Midlet

The yahoo local search application that I mentioned in the previous post consists of two components. The first component is the midlet, which works on any java enabled cell phone. The midlet does not directly communicate with the yahoo webservice, instead it communicates with a servlet (the second component) which in turn forwards the queries to the yahoo webservice.

The decision to have a servlet-midlet pair was deliberate. I wanted to experiment to see what issues I would face when having a servlet communicate with a midlet. So far I haven't run into any problems and its been smooth sailing, though it has to be noted that the communication only consisted of simple strings being exchanged. The real test would be when things get more complicated.

The alternative to using a servlet-midlet pair is to have the cell phone communicate with the Yahoo service directly. This isn't really complicated, but it would entail parsing XML on the cell phone itself. I have another application with which one can access the Yahoo News service, which uses the KXML library to parse the xml returned from Yahoo. I will get around to posting that application soon.

I will try my best to post instructions to get the servlet and the midlet working. In the meanwhile you could try to use the nokia PC suite (which I have used, since I have a Nokia) to upload midlet onto the phone. On the server side I use tomcat to host the servlet. I am sure there are a lot of sites which would provide instructions on loading a servlet into tomcat. I simply use the sysdeo plug-in via eclipse to use the servlet.

The link to download the applications are:

midlet component

Servlet component

The code for the midLet

Feedback is always welcome



Note: The midlet has the address of the server hardcoded into it. In order to use the midlet, you would have to edit the code. After you unzip the file, open midletTest.java and replace the line private static String url = "http://localhost:8080/testJ2ee/servlet/yahoo.local/";
to reflect the location of your servlet.

No comments: