Thursday, April 12, 2007

Application/Service for Blackberry

I just tried my hands on building a sample RssReader for Blackberry.It was quite a tedious process at first.I downloaded and installed BlackBerry MDS studio.I tried to develop a sample application as given in the quick start guide.

There are three approaches :

1.Quick start approach
2.Bottom up approach
3.Top Down approach

I used Bottom Up approach.The Blackberry takes a WSDL(Web Service Descrption Language) file as input.The WSDL file specifies the methods,parameters and the URL through which the service can be accessed.Then we need to place the necessary components on the screen and bind them to the appropriate methods.This is something similar to visual basic.Here everything is Drag and Drop.The step by step tutorial to do these are given in the 'Developers guide tutorial ' in the BlackBerry site.

Finally you can test the application with the simulator.This looks pretty simple na? I too felt the same way.But when i started doing my RssReader application , i came to know that there are several tasks to be done in the back end.

Life Cycle :

1.Create a WSDL file :

In order to create a WSDL file , you need to download and install axis2 engine.You also need to have apache ant installed. Then you have to set the classpath to apache ant and jdk.Then create a interface file in java.Its jus t another class file. Then using java2wsdl converter in axis2 generate the WSDL file.For example , in command prompt

%AXIS2_HOME%/bin/java2wsdl -cp . -cn samples.quickstart.service.pojo.StockQuoteService -of StockQuoteService.wsdl

For reference Click here

when you do this you will get a WSDL file.

2.Build service from WSDL file:

In order to build service , use wsdl2java converter of axis2.For example , in command prompt

%AXIS2_HOME%/bin/WSDL2Java -uri resources/META-INF/StockQuoteService.wsdl -p samples.quickstart.service.xmlbeans -d xmlbeans -s -ss -sd -ssi -o build/service

For reference Click here

When you do this you will get a 'build' folder structure , that contains several files and folder.In that open the corresponding skeleton(java) file in the xmlbean directory , inside build directory and implement your logic in that file.

Then use the command "ant jar.server" in the comand prompt , to build the service.If build successfull , you will get a ".aar" file inside that build directory.

3.Implementing the service:

To test it locally , get tomcat installed. Put axis2.war file within the webapps directory of tomcat and it will automatically explode into axis2 directory structure when the tomcat server is started.Then place the .aar file into the service folder within the axis2 directory of the tomcat.

Now restart the tomcat , and the generated WSDL file is given as input to blackberry.This is the overall view of developing a service or application for blackberry.

No comments: