Building WAP-enabled Applications with JBuilder ™ and Inprise ™ Application Server ™ Adding WAP clients as an additional presentation layer into enterprise applications. by Giles Davies, Inprise/Borland UK Introduction This document demonstrates how to provide WAP access into an enterprise application, in this case using EJB ™ in the business logic layer. The intent is to demonstrate how WAP clients can be developed with JBuilder ™ to provide another client presentation layer onto existing or new enterprise applications. Table of Contents Introduction 1 Summary 2 WAP Overview 3 The WAP Application 4 Resources 11 Appendix 12 Fig 1. The portfolio screen from the example application. JBu ilde r
13
Embed
Building WAP-enabled Applications with JBuilder Application WAP-enabled Applications with JBuilder ... routed via a WAP Gateway, which can then either return WML from the target URL
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
BuildingWAP-enabledApplicationswith JBuilder™
and Inprise™
ApplicationServer™
Adding WAP clients as an additionalpresentation layer into enterpriseapplications.
by Giles Davies, Inprise/Borland UK
Introduction
This document demonstrates how to provide WAP access
into an enterprise application, in this case using EJB™ in
the business logic layer.
The intent is to demonstrate how WAP clients can be
developed with JBuilder™ to provide another client
presentation layer onto existing or new enterprise
applications.
Table of ContentsIntroduction 1
Summary 2
WAP Overview 3
The WAP Application 4
Resources 11
Appendix 12
Fig 1. The portfolioscreen from theexample application.
JBu ilder
JBuilder
2
Glossary
Acronym Description
DTD Document Type Definition
EJB Enterprise JavaBean™
HTML Hyper Text Markup Language
HTTP Hyper Text Transfer Protocol
IAS Inprise™ Application Server™
IP Internet Protocol
JSP Java™ Server Page
JWS Java Web Server™
MIME Multi-purpose Internet Mail
Extensions
SSL Secure Socket Layer
TCP Transmission Control Protocol
UDP User Datagram Protocol
URL Uniform Resource Locator
WAP Wireless Application Protocol
WML Wireless Markup Language
WSP Wireless Session Protocol
WTLS Wireless Transport Layer Security
WTP Wireless Transport Protocol
XML eXtended Markup Language
Summary
It is projected that by the end of 2002, there will be as
many people accessing the Internet by handheld devices
as by desktop computers. Beyond 2002, the numbers of
people accessing the Internet by handheld devices will
increase dramatically, and start to put desktop access in
the minority. For many people, their first, and perhaps
only, meaningful interaction with the Internet may be via
handheld devices, such as mobile phones, PDAs, or their
successors.
WAP is therefore going to be an increasingly important
means of delivering services to end users. Developers,
architects, and business managers need to provide WAP
access into their enterprise applications to compete
effectively.
WAP presents several opportunities:
• A new channel for existing services.
• The scope for an entirely new set of services that
capitalize on the mobile paradigm.
• Access to a much larger user base
This document demonstrates the building of an enterprise
application, based around a fictional bank, which offers
financial services to its customers via a variety of
interfaces, from the native desktop applications of its
employees, to both Web- and WAP-based access.
In the process, it is intended to show that WAP is another
presentation layer, and that a well designed system, with
the business logic layers separated from the presentation
layers, can incorporate a WAP interface without needing
to reengineer the business logic.
The WAP client places a number of restrictions on the
developer, primarily concerning the limited display
characteristics of today’s devices. Being aware of these
issues is important in deciding what services can be made
available.
This document will briefly overview WAP as a
technology, before walking through writing the example
application, using Java® servlets built using Borland®
JBuilder™ 3.5.
WAP Overview
What is WAP?
WAP is the Wireless Application Protocol. It is an open
standard designed to allow users of mobile/handheld
JBuilder
3
devices to gain access to the Internet as easily as they can
make telephone calls, send SMS messages, and so on.
There are limitations with the current range of WAP
devices. As we shall see, going to the Internet via a WAP
device is a different experience from accessing the
Internet via a traditional Web browser on a desktop
computer. Nevertheless, there are great possibilities for
services via WAP.
Who’s behind WAP?
WAP is the product of the WAP Forum
( www.wapforum.org ), an association founded in 1997 by
Ericsson, Motorola, Nokia, and Phone.com (formerly
Unwired Planet). The WAP Forum now has over 200
members and represents over 95 percent of the global
handset market.
The primary goal of the WAP Forum is “to bring together
companies from all segments of the wireless industry
value chain to ensure product interoperability and growth
of wireless market.”
WAP Architecture
WAP consists of a number of protocols, which are
analogous to the protocols required by “normal” HTTP
Web communication.
Layer WAP Web
Application Layer Wireless
Application
Environment
(WML and
WMLScript)
HTML, Scripting
languages
Transport Layer WSP, WTP, WTLS
and WDP
HTTP, SSL, TCP,
UDP
Network Layer Bearer IP
In addition to these protocols, there are some additional
elements required by WAP, including:
• A microbrowser. Used by the WAP device to render
the WML and/or WMLScript to the user.
• A WAP Gateway. This can provide integration and
routing facilities.
When a WAP device is used, the user enters a URL into
the device’s microbrowser by either using a bookmark or
typing the URL, as with Web browsers. This URL may be
routed via a WAP Gateway, which can then either return
WML from the target URL or, if appropriate, pass HTML
through an HTML filter to return WML to the WAP device.
HTML
Filter
URL URL
WML
(Compiled)
WML
HTML
WAP
Gateway
Target HostWAP Device
JBuilder
4
Fig 2. High-level overview of WAP communication.
A frequently asked question is whether a WAP Gateway
is necessary. A WAP Gateway essentially allows full
integration into a Service Provider’s facilities, which could
include:
• Personalization services, such as online customization
of the user’s bookmarks, which are then updated on
the WAP device.
• Integration into enterprise services such as e-mail or
security.
It is not therefore a requirement that a WAP Gateway be
used, as WML can be accessed from the WAP device
directly from a normal Web server. Note that it may be
necessary to set up the WAP MIME types in the Web
server, which will be covered later in this document.
WML
The Wireless Markup Language is XML-based, defined in
an XML DTD. For example, the DTD for WML 1.1 is
http://www.wapforum.org/DTD/wml_1.1.xml. WML
supports text, images, user input, option lists, hyperlink
navigation, and unicode.
The good news is that WML is very like HTML. Many of
the tags are the same, and familiarity with HTML enables
fast learning of WML.
The bad news is that WML is very like HTML—similar
enough to be familiar, but with sufficient differences to
be initially frustrating! For example, all tags must be
completed, something that is less strictly enforced in
HTML. Similarly, all tags must be in lower case, rather
than in the mixture of cases that HTML permits.
WML also has a few, more fundamental structural
differences from HTML, reflecting the different
environment that the microbrowsers operate in; namely,
a WAP device’s screen is small and typically
monochrome. These differences, in conjunction with a
download capability of 9600 kbps, provides a solution by
WML that is of a deck of cards. The basic concept, is
that a number of screens’ worth of data (the cards) are
downloaded together in one file (the deck). This helps
overcome issues of network latency that might otherwise
impose relatively lengthy delays for each small screen’s
worth of WML. Navigation between cards and decks is
achieved using <href> hyperlinks, as with HTML. As well
as having the cards, it is also possible to provide a
template in the deck, which can be used to provide one
or more options on every card. A typical example is to
provide a “back” option so that the user can return to the
previous screen.
Fig 3. WML’s deck of cards.
The WAP Application
Objectives
This sample application is designed to:
1. Illustrate WAP functionality.
2. Demonstrate how WAP clients can access enterprise
services.
CardCard
CardTemplate
Card
CardCard
JBuilder
5
3. Demonstrate that WAP clients can be added as “just”
another presentation layer into applications.
Scenario
For this example, the supposed scenario is as follows:
MBank, a hypothetical bank, wants to allow their
customers to:
• view their account balances, and
• view the current stock values in their portfolio
via either the Web or from a WAP device.
For these purposes, the back end business logic is
provided via EJBs hosted in Inprise™ Application Server™
4.0 (IAS 4), and access into the EJBs is achieved via a
presentation server layer of servlets run in Java Web
Server, as supplied with IAS 4.
Fig. 4. Schematic diagram of the example application.
Develop the business logic
The first step is to develop the business logic that actually
represents the customer’s accounts and portfolio. In this
example, this layer is kept deliberately simple in order to
concentrate on the presentation layers.
Two EJBs were written; a Container Managed Persistence
Entity Bean representing an account, and a Stateful
Session Bean representing processes available to a
customer, in this case supporting account balance queries
and stock portfolio updates.
These EJBs were built using JBuilder 3.5 following these
steps for each EJB:
1. Create the EJB using the EJB wizard.
2. Add the methods required into the bean class itself.
3. Run the EJB Interfaces wizard to generate the Home
and Remote Interfaces as well as the XML EJB
Deployment Descriptor.
4. Complete the EJB Deployment Descriptor.
5. Package the EJB(s) into a JAR file using the
Deployment Wizard.
6. Deploy the JAR file to the EJB container using the EJB
Deployment Wizard.
For a full breakdown of the steps required in writing EJBs