This tutorial describes how to use the NetBeans IDE to create a mobile client application that uses a Web service. We'll create an application that extracts daily Dilbert comics from Live online Web services, converts graphics into space-saving formats, and then displays comics on mobile devices.
In this tutorial, we will first create a WEB service client in the mobile application to connect to the online Dailydilbert service. We will then demonstrate how to design the application layout graphically using Visual MIDlet Designer. Next, add code to convert the graphic format of the comics from GIF to the PNG format supported by the mobile device. Finally, use the simulator to appreciate comic strips in the IDE.
The software required for this tutorial
Before you begin, you need to download and install the following software on your computer:
Java Standard Development Kit (JDK) version 5.0 or 6.0
Full release of NetBeans IDE 6.0
Java EE 5 servers, such as GlassFish or TOMCAT, can be installed with the above project.
Creating a Web service client
First, we need to create a new WEB application project. The project will contain the required Web service client.
Select the File > New Project option. From the Categories list, select the Web option. From the Projects list, select the WEB application option. Click the Next button.
Name the project dilbertwebapplication and select the Java EE 5 option, as shown below.
Click the Finish button and the IDE will create the application.
The application was created successfully, and the Projects window should look like the following:
Using the Web Service Client Wizard
Now we will add a WEB service client and let it use the Dailydilbert service.
Right-click the Dilbertwebapplication project node and select New > Web Service Client. Alternatively, you can select this wizard from the New File Wizard as follows: