Home > Store

Enterprise J2ME: Developing Mobile Java Applications

Register your product to gain access to bonus material or receive a coupon.

Enterprise J2ME: Developing Mobile Java Applications


  • Sorry, this book is no longer in print.
Not for Sale


  • Copyright 2004
  • Edition: 1st
  • Book
  • ISBN-10: 0-13-140530-6
  • ISBN-13: 978-0-13-140530-1

Mobile enterprise information systems will soon be one of the major applications of wireless technology. Java 2 Micro Edition is poised to be an important platform for developing wireless enterprise applications. Enterprise wireless applications allow workers to access crucial business information from any place at any time. This book covers the design, architecture, tools and development methodology for the Web Services that will be the killer app for this very promising platform. The author explains the value of mobile commerce and discusses architecture and system design considerations. This book explains not only API usages but also the designs behind the APIs so that you can learn how to extend those technologies for your custom requirements!


Source Code

Untitled Document

Download the complete source code and build instructions for the example applications related to this title.



Related Articles

Programming for the Mobile World

Using the Java Wireless Toolkit


Untitled Document

To facilitate your work with the resources mentioned in the text, below please find links to Web-based references mentioned at the end of the chapters.

Chapter 2

Chapter 3

Chapter 4

Chapter 5

Chapter 6

Chapter 7

Chapter 8

Chapter 9

Chapter 10

Chapter 11

Chapter 12

Chapter 13

Chapter 14

Chapter 15

Chapter 16

Chapter 17

Chapter 18

Chapter 19

Chapter 20

Sample Content

Online Sample Chapter

Overcoming Challenges in Mobile J2ME Development

Downloadable Sample Chapter

Download the Sample Chapter related to this title.

Table of Contents


About the Book.



1. Mobile Commerce: Visions, Realities, and Opportunities.

Mobile Commerce Value Propositions. Mobile Technology Adoption. The Search for Killer Mobile Applications. Mobile Commerce Landscape. Summary. Resources.

2. J2M 2ME: Is Mobile Java Ready for Enterprise?

Why Java? The Java Community Process. Java Everywhere. Java 2 Micro Edition Explained. Competing Technologies. Summary. Resources.


3. The Smart Client Paradigm: iFeedBack.

Benefits of Smart Clients. Introducing iFeedBack. iFeedBack Usage Scenarios. Implementation Walk Through. Summary. Resources.

4. Managed Smart Clients.

Container-Managed Applications. OSGi Containers. A Simple Echo Service Example. Smart Client with HTTP Front End. Mobile Gateways. Summary. Resources.

5. Mobile Design Patterns: The Smart Ticket Blueprint.

Getting Started. Smart Ticket in Action. Important Architectural Patterns. Implementation Techniques. Summary. Resources.

6. Advanced HTTP Techniques.

The Decorator Approach. The Process-Chain Approach. Session Tracking via HTTP Cookies. HTTP Basic Authentication. HTTP Digest Authentication. Secure HTTP. Summary. Resources.

7. End-to-End Best Practices.

Limited Device Hardware. Slow, Unreliable Networks. Pervasive Devices. Ubiquitous Integration. The Impatient User. Summary. Resources.


8. Email and PIM.

Basics of Email. Introducing Mail4ME. The JavaPhone API. The PDA Optional Package. Commercial Email and PIM Suites. Corporate Portal Servers. Summary. Resources.

9. Converged Mobile P2P 2P Messaging.

Introducing the Wireless Messaging API. WMA in Action. WMA Reference Implementation. SMS from the Backend. Beyond SMS: The IM Convergence. SIP-Based IM Applications. Summary. Resources.

10. Enterprise Messaging.

Mobile Enterprise Messaging. Introducing the JMS. Mobile JMS from iBus//Mobile. The IBM WebSphere MQ Everyplace. Summary. Resources.


11. Mobile Database for CDC Devices.

Database on the Go. Introducing JDBC. Portable and Efficient Code Using PreparedStatement. Access Stored Procedures Using CallableStatement. The JDBC Optional Package for the CDC. HSQL Database Engine. iAnywhere Solutions SQL Anywhere Studio. IBM DB2 Everyplace. Oracle9i Lite. PointBase Micro Edition. Example Application: Contact Manager. Summary. Resources.

12. Mobile Databases for MIDP DP devices.

PointBase Micro Edition. The Oracle J2ME SODA SDK. The IBM DB2e FastRecordStore. Summary. Resources.

13. Database Synchronization.

Synchronization and Mobility. PointBase UniSync. IBM DB2 Everyplace. iAnywhere Solutions MobiLink. Oracle9i Mobile Server. The Synchronized Contact Manager. Summary. Resources.

14. Access Backend Databases.

Direct Access to Remote Databases. The Oracle J2ME SQL SDK. Legacy Applications. Using Simplicity for Legacy Databases. Summary. Resources.


15. XML for Small Devices.

What Is XML? Challenges for Small Devices. XML Parsing Models. Introducing Amazon XML Services. Amazon Services via XmlPull. Amazon Services via kDOM. A Mobile RSS Client. Summary. Resources.

16. SOAP Web Services on Smart Clients.

What Is SOAP Web Services? Introducing kSOAP. kSOAP Explained. Advanced kSOAP. More kSOAP Examples. What's in kSOAP v2.0? Summary. Resources.

17. The J2M 2ME Web Services Optional Package.

A Little History. The XML Processing API. The JAX-RPC API. The SPI for Implementers. Compare with kXML and kSOAP. Summary. Resources.

18. Case Study: Mobile Clients for Location on-Based Services.

Location-Based Service. Microsoft MapPoint Web Services. MapPoint J2ME Clients. Enhancing the Driving Directions Application. Summary. Resources.


19. Mobile Security for Enterprise.

What Is Advanced Mobile Security? Lightweight Mobile Cryptography Toolkits. Bouncy Castle Lightweight API. The IAIK ME JCE. Phaos Technology Micro Foundation Toolkit. NTRU jNeo for Java Toolkit. B3 Security. Device-Specific APIs. Standardization of J2ME Security APIs. Summary. Resources.

20. The J2M 2ME Crypto Recipes.

Overview of Recipes. Symmetric Encryption. Password-Based Encryption. Public Key Encryption. Digital Signature. Summary. Resources.

A: Basics of J2M 2ME Application on Development.

Life Cycle Methods. UI Model. Remote and Local Data. Code Walkthrough. Packaging and Building. Deployment. Summary.

B: Tools and J2M 2ME Runtimes for PDAs.

Overview of the WebSphere Studio Device Developer. Installing MIDP on PocketPC Devices. Installing Personal Profile on PocketPC Devices. Run Java Applications on the PocketPC Device. Summary.



Untitled Document

About this Book

Target Audience

This book targets all mobile software developers and business decision makers. It focuses on end-to-end architectural patterns, best practices, key innovations, and real-world design approaches. For different readers, this book offers different benefits:

  • Managers and entrepreneurs : This book is a comprehensive guide to mobile enterprise applications and the Java 2 Micro Edition (J2ME). It covers the capabilities, limitations, common best practices, and commercial solutions of the state-of-the-art mobile Java technologies. It helps you decide which mobile Java profile and products are the best for your business.
  • Experienced mobile developers : This book skips the basic MIDP API tutorial materials and goes straight to the more advanced and more useful topics. It uses several complete sample applications to illustrate common architectural patterns and coding best practices in mobile enterprise applications. For developers who are looking for specific solutions (e.g., messaging, database, XML, and security), the technical discussions on leading third-party J2ME tools and libraries will prove useful. Those real-world innovations also serve as prime examples of how you should design and implement your own solutions for similar tasks.
  • Experienced Java developers : For experienced Java enterprise developers (J2EE developers), the move to mobility is about leveraging existing skills. This book walks through familiar design patterns and best practices and shows developers how to apply them in mobile applications. Lightweight mobile versions of enterprise Java APIs (such as JDBC, Java servlet, JMS, and Java Cryptography Extension) are discussed. Those are excellent examples of how to scale down enterprise solutions for mobility while still preserving core functionalities. With a few notes on mobile-specific issues, it is the fastest path to add mobility to existing enterprise infrastructure.


To fully understand the technical content in this book, the readers should be familiar with the basic Java 2 Micro Edition, Mobile Information Device Profile (J2ME/MIDP) APIs and development tools. A quick MIDP programming guide is provided in Appendix A.

To run the end-to-end sample applications, you will need to deploy the serverside components to your own Java application server and run the clientside components on the desktop emulator or real devices. Please refer to the product manuals of your tools for step-by-step instructions.

Although serverside Java is not the focus of this book, familiarity with basic Java 2 Enterprise Edition (J2EE) concepts such as servlets, Java DataBase Connectivity (JDBC), Java Messaging Service (JMS), Java XML processing, and Enterprise JavaBean (EJB), will help you understand various topics in this book.


This book is divided into six parts:

  • Part I is the introductory material for mobile commerce, mobile enterprise applications, and J2ME. It covers the overall architecture, current status, and future roadmaps of J2ME.
  • Part II is the heart of this book. It presents several example applications to illustrate the smart client mobile application paradigm, common architectural patterns, and best practices. It covers how to run container-managed applications (e.g., servlets) on PDA devices. It also presents a useful advanced HTTP client library for J2ME clients.
  • Part III is about mobile messaging. In the mobile world, messaging clients are easy to use and fit into the mobile lifestyle. In the enterprise world, messaging is the best way to build loosely coupled applications that have guaranteed quality-of-service (QoS). This part of this book seeks to combine the best of the two worlds. It covers email and SMS-based end-to-end applications as well enterprise mobile messaging servers.
  • Part IV discusses mobile databases that are core to occasionally connected and synchronization-based applications. This part covers commercial and open source innovations for mobile databases, synchronization engines, and legacy database connectivity. Two sample database applications from PointBase are presented.
  • Part V covers how to integrate mobile clients into the enterprise Web services infrastructure. It discusses existing and emerging J2ME XML and SOAP toolkits, specifications and showcases several complete sample applications.
  • Part VI is all you need to know about J2ME mobile security solutions. It goes way beyond the simple connection-based end-to-end solutions such as the HTTPS. This part covers open source and commercial cryptography toolkits for J2ME. Due to the complexity of cryptography APIs, API tutorials for each important toolkit are provided.
  • There are two appendices to this book. One of them uses a simple end-to-end MIDP application to illustrate the whole development and deployment cycle. The other appendix introduces the IBM WebSphere Studio Device Developer IDE and provides undocumented instructions on how to install IBM J2ME runtimes on PocketPC devices.

Code Examples

This book uses complete example applications to demonstrate design patterns, best practices, and important API usages. Since this book discusses a wide range of technologies, innovations, and application scenarios, it is impractical to cover everything within a monolithic example. Instead, I decided to develop several small to midsize samples, each focusing on a particular topic. This approach allows the readers to partition the learning task and read one part of this book at a time.

The source code is presented in easy-to-digest segments that are relevant to the discussion text. Nonessential parts of the code (e.g., exception handling, importing packages) are often deliberately omitted from the listings for clarity. Hence, the printed listings are suffcient for understanding the ideas but are not directly runnable code.

  • iFeedBack : The grand prize winner of the NexTel/Motorola/Sun wireless application contest in 2002 (Chapter 3).
  • Echo : A GUI client and a service running in an OSGi clientside container (Chapter 4).
  • Pizza Order : An example included in the IBM Service Management Framework download. It demonstrates how to build smart clients with HTTP front ends (Chapter 4).
  • Smart Ticket : The Sun Wireless Blueprints application v2.0 early release code (Chapter 5).
  • HttpClient : The code for the advanced HTTP library we develop in this section (Chapter 6).
  • Mail : An MIDP email client based on the Mail4ME v1.0 library (Chapter 8).
  • WMATester : A simple messaging application that illustrates the use of Wireless Messaging API v1.0 (Chapter 9).
  • ContactManager : A mobile address book based on the PointBase v4.5 library (Chapter 11).
  • ContactManagerSync : A synchronized mobile address book based on the PointBase v4.5 library (Chapter 13).
  • AmazonExample : An kXML client for AmazonWeb services using both kDOM and XmlPull APIs (Chapter 15).
  • PeekAndPick : A RSS reader for mobile phones developed by Jonathan Knudsen (Chapter 15).
  • Google : A simple client for the Google Web services API. Both kSOAP v1.2 and v2.0 versions are available (Chapter 16).
  • SmartPhrases : An integrated Google search and online dictionary application (Chapter 16).
  • MapPoint AxisFacade : An Apache Axis facade for MapPoint v3.0 Web services (Chapter 18).
  • MapPoint AxisClient : Personal Profile and MIDP clients for the Map-Point facade (Chapter 18).
  • MobileSecurity : A collection of small applications that demonstrate the correct usage of cryptography APIs (Chapter 20).
  • SimpleDemo : A simple MIDP application to illustrate key concepts and APIs in MIDP programming (Appendix A).

Commercial Products

This book covers and compares more than 30 toolkits and libraries from more than a dozen third-party vendors. The descriptions and API usage examples of those products are intended to give the readers a solid technical ground to make informed comparisons and decisions. They also serve as realworld examples for API and tool designs. However, they do not substitute for the formal product documentation from the vendor. I strongly encourage interested readers to obtain the latest evaluation package and documentation from the vendor to investigate further.

Related Publications

Some of the materials used in this book are loosely based on articles I published previously on several online magazines.

  • The Sun Smart Ticket blueprint discussed in Chapter 5 is also covered in “End-to-End J2ME Application Development by Example,” published on the Sun Wireless Java Web site in June 2003.
  • The first half of Chapter 9 is also covered by “Mobile P2P messaging, Part 1,” published on IBM developerWorks in December 2002.
  • Examples in Part IV are adapted from “High-availability mobile applications,” published on JavaWorld in June 2003.
  • Chapter 16 is based on “Access Web services from wireless devices,” published on JavaWorld in August 2002.
  • The example in Chapter 18 is adapted from “Let the mobile games begin, Part 2,” published on JavaWorld in May 2003.
  • Part VI is loosely based on “Data security in mobile Java applications,” published on JavaWorld in December 2002.

Production Notes

This book is produced by the Latex typesetting system on a 1GHz Apple PowerBook running Mac OS X—the best consumer operating system ever produced. Microsoft Word is used for collaborative editing and reviewing. The figures are made with Microsoft Visio, OmniGra2e, GIMP, and the ImageMagick utilities.

The example applications are developed using a variety of development tools, including VI, JEdit, IntelliJ IDEA, and the WebSphere Studio Device Developer IDE. Apache Ant is used to build the applications. Mobile clients are tested on many vendor SDKs, including those from Sun Microsystems (the J2ME Wireless ToolKit), IBM (the WebSphere Micro Environment), Nokia, and Motorola. Real device testing was conducted on Motorola i95cl, Nokia 7210, Nokia 6800, and PocketPC Phone devices.


Download the Index file related to this title.


Submit Errata

More Information

InformIT Promotional Mailings & Special Offers

I would like to receive exclusive offers and hear about products from InformIT and its family of brands. I can unsubscribe at any time.


Pearson Education, Inc., 221 River Street, Hoboken, New Jersey 07030, (Pearson) presents this site to provide information about products and services that can be purchased through this site.

This privacy notice provides an overview of our commitment to privacy and describes how we collect, protect, use and share personal information collected through this site. Please note that other Pearson websites and online products and services have their own separate privacy policies.

Collection and Use of Information

To conduct business and deliver products and services, Pearson collects and uses personal information in several ways in connection with this site, including:

Questions and Inquiries

For inquiries and questions, we collect the inquiry or question, together with name, contact details (email address, phone number and mailing address) and any other additional information voluntarily submitted to us through a Contact Us form or an email. We use this information to address the inquiry and respond to the question.

Online Store

For orders and purchases placed through our online store on this site, we collect order details, name, institution name and address (if applicable), email address, phone number, shipping and billing addresses, credit/debit card information, shipping options and any instructions. We use this information to complete transactions, fulfill orders, communicate with individuals placing orders or visiting the online store, and for related purposes.


Pearson may offer opportunities to provide feedback or participate in surveys, including surveys evaluating Pearson products, services or sites. Participation is voluntary. Pearson collects information requested in the survey questions and uses the information to evaluate, support, maintain and improve products, services or sites, develop new products and services, conduct educational research and for other purposes specified in the survey.

Contests and Drawings

Occasionally, we may sponsor a contest or drawing. Participation is optional. Pearson collects name, contact information and other information specified on the entry form for the contest or drawing to conduct the contest or drawing. Pearson may collect additional personal information from the winners of a contest or drawing in order to award the prize and for tax reporting purposes, as required by law.


If you have elected to receive email newsletters or promotional mailings and special offers but want to unsubscribe, simply email information@informit.com.

Service Announcements

On rare occasions it is necessary to send out a strictly service related announcement. For instance, if our service is temporarily suspended for maintenance we might send users an email. Generally, users may not opt-out of these communications, though they can deactivate their account information. However, these communications are not promotional in nature.

Customer Service

We communicate with users on a regular basis to provide requested services and in regard to issues relating to their account we reply via email or phone in accordance with the users' wishes when a user submits their information through our Contact Us form.

Other Collection and Use of Information

Application and System Logs

Pearson automatically collects log data to help ensure the delivery, availability and security of this site. Log data may include technical information about how a user or visitor connected to this site, such as browser type, type of computer/device, operating system, internet service provider and IP address. We use this information for support purposes and to monitor the health of the site, identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents and appropriately scale computing resources.

Web Analytics

Pearson may use third party web trend analytical services, including Google Analytics, to collect visitor information, such as IP addresses, browser types, referring pages, pages visited and time spent on a particular site. While these analytical services collect and report information on an anonymous basis, they may use cookies to gather web trend information. The information gathered may enable Pearson (but not the third party web trend services) to link information with application and system log data. Pearson uses this information for system administration and to identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents, appropriately scale computing resources and otherwise support and deliver this site and its services.

Cookies and Related Technologies

This site uses cookies and similar technologies to personalize content, measure traffic patterns, control security, track use and access of information on this site, and provide interest-based messages and advertising. Users can manage and block the use of cookies through their browser. Disabling or blocking certain cookies may limit the functionality of this site.

Do Not Track

This site currently does not respond to Do Not Track signals.


Pearson uses appropriate physical, administrative and technical security measures to protect personal information from unauthorized access, use and disclosure.


This site is not directed to children under the age of 13.


Pearson may send or direct marketing communications to users, provided that

  • Pearson will not use personal information collected or processed as a K-12 school service provider for the purpose of directed or targeted advertising.
  • Such marketing is consistent with applicable law and Pearson's legal obligations.
  • Pearson will not knowingly direct or send marketing communications to an individual who has expressed a preference not to receive marketing.
  • Where required by applicable law, express or implied consent to marketing exists and has not been withdrawn.

Pearson may provide personal information to a third party service provider on a restricted basis to provide marketing solely on behalf of Pearson or an affiliate or customer for whom Pearson is a service provider. Marketing preferences may be changed at any time.

Correcting/Updating Personal Information

If a user's personally identifiable information changes (such as your postal address or email address), we provide a way to correct or update that user's personal data provided to us. This can be done on the Account page. If a user no longer desires our service and desires to delete his or her account, please contact us at customer-service@informit.com and we will process the deletion of a user's account.


Users can always make an informed choice as to whether they should proceed with certain services offered by InformIT. If you choose to remove yourself from our mailing list(s) simply visit the following page and uncheck any communication you no longer want to receive: www.informit.com/u.aspx.

Sale of Personal Information

Pearson does not rent or sell personal information in exchange for any payment of money.

While Pearson does not sell personal information, as defined in Nevada law, Nevada residents may email a request for no sale of their personal information to NevadaDesignatedRequest@pearson.com.

Supplemental Privacy Statement for California Residents

California residents should read our Supplemental privacy statement for California residents in conjunction with this Privacy Notice. The Supplemental privacy statement for California residents explains Pearson's commitment to comply with California law and applies to personal information of California residents collected in connection with this site and the Services.

Sharing and Disclosure

Pearson may disclose personal information, as follows:

  • As required by law.
  • With the consent of the individual (or their parent, if the individual is a minor)
  • In response to a subpoena, court order or legal process, to the extent permitted or required by law
  • To protect the security and safety of individuals, data, assets and systems, consistent with applicable law
  • In connection the sale, joint venture or other transfer of some or all of its company or assets, subject to the provisions of this Privacy Notice
  • To investigate or address actual or suspected fraud or other illegal activities
  • To exercise its legal rights, including enforcement of the Terms of Use for this site or another contract
  • To affiliated Pearson companies and other companies and organizations who perform work for Pearson and are obligated to protect the privacy of personal information consistent with this Privacy Notice
  • To a school, organization, company or government agency, where Pearson collects or processes the personal information in a school setting or on behalf of such organization, company or government agency.


This web site contains links to other sites. Please be aware that we are not responsible for the privacy practices of such other sites. We encourage our users to be aware when they leave our site and to read the privacy statements of each and every web site that collects Personal Information. This privacy statement applies solely to information collected by this web site.

Requests and Contact

Please contact us about this Privacy Notice or if you have any requests or questions relating to the privacy of your personal information.

Changes to this Privacy Notice

We may revise this Privacy Notice through an updated posting. We will identify the effective date of the revision in the posting. Often, updates are made to provide greater clarity or to comply with changes in regulatory requirements. If the updates involve material changes to the collection, protection, use or disclosure of Personal Information, Pearson will provide notice of the change through a conspicuous notice on this site or other appropriate way. Continued use of the site after the effective date of a posted revision evidences acceptance. Please contact us if you have questions or concerns about the Privacy Notice or any objection to any revisions.

Last Update: November 17, 2020