RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX


Turn Your J2ME Mobile Devices into Web Service Clients

If Web services are expanding within your enterprise, it might be time for you to look at all those mobile devices as potential clients of your Web services. Learn how to use the J2ME Web Service APIs to extend the enterprise to include J2ME devices with a simple example application.

o, Web services are big and getting bigger, but what does that mean to Java development, specifically J2ME, for mobile devices? Until recently, the answer was "not much" unless you wanted to implement the entire Web services infrastructure yourself. However, in 2004, the Java Community Process approved and finalized JSR-172, the J2ME Web Services Specification. More recently, Sun and IBM have added implementations of this specification into their J2ME development environments, and importantly, some mobile products such as those running Symbian Series 60 OS now come with this optional J2ME API.

J2ME Web services are based on the general Web services architecture and specifications, but looking at them from strictly the client, or service consumer, vantage point, J2ME Web services consists of two optional packages: one for remote service invocation (Java API for XML-based RPC or JAX-RPC) and one for XML parsing (Java API for XML Processing or JAXP). By design, the packages are independent from one another; allowing for the use of one without the other. The APIs are meant to provide Web service access via profiles from either J2ME Connected Device (CDC) or Connected Limited Device Configurations (CLDC). To help you learn more about these two APIs and how they work to provide access to Web services in J2ME applications, this article explores a small, example Java Web service and J2ME MIDP MIDlet.

What You Need
To build and run the example, here is the list of tools you will need:

  • Sun's J2ME Wireless Toolkit 2.2: Sun's J2ME development toolkit provides build tools, utilities, and device emulators.
  • Tomcat 5.0 for Java WSDP: This Web container is based on Apache's Jakarta Tomcat. It implements the JSP and servlet specifications. While it is not intended for production use, it provides an easy-to-learn and use platform for hosting a Web service.
  • Java Web Services Developer Pack 1.5: A Web service toolkit that can be integrated with the Tomcat Web container (above) that will allow you to build and test Web services.
  • Apache Ant: A Java-based tool for building and deploying your Web service.
Each of the above tools download and install in a matter of minutes. The tools to create and run the application will be used "as is." Simply follow the instructions for installation with each product.

You will also need something to create and edit your Java code and XML files. The associated code with this article should be extracted right into the apps directory of your Wireless Toolkit download. Extract the code from the download file into your WTK22/apps directory.

Close Icon
Thanks for your registration, follow us on our social networks to keep up-to-date