Newsletter sign-up
View all newsletters

Sign up for our technology specific newsletters.

Enterprise Java
Email Address:

WAP for Java developers

Develop WAP applications with Java servlets and JSP

  • Digg
  • Reddit
  • SlashDot
  • Stumble
  • del.icio.us
  • Technorati
  • dzone

Page 2 of 6

Figure 1. The WAP network structure



In Figure 1, the client communicates with the WAP gateway in the wireless network. The WAP gateway translates WAP requests to WWW requests, so the WAP client is able to submit requests to the Web server. Also, the WAP gateway translates Web responses into WAP responses or a format understood by the WAP client.

The WAP programming model

The WAP programming model is similar to the Web programming model with matching extensions, but it accommodates the characteristics of the wireless environment. Figure 2 illustrates this model.

Figure 2. The WAP programming model

As you can see, the WAP programming model is based heavily on the Web programming model. But how does the WAP gateway work with HTML? In some cases, the data services or content located on the Web server is HTML-based. Some WAP gateways could be made to convert HTML pages into a format that can be displayed on wireless devices. But because HTML wasn't really designed for small screens, the WAP protocol defines its own markup language, the Wireless Markup Language (WML), which adheres to the XML standard and is designed to enable powerful applications within the constraints of handheld devices. In most cases, the actual application or other content located on the Web server will be native WAP created with WML or generated dynamically using Java servlets or JSP.

In HTML, there are no functions to check the validity of user input or to generate messages and dialog boxes locally. To overcome this limitation, JavaScript was developed. Similarly, to overcome the same restrictions in WML, a new scripting language known as WMLScript has been developed. I'll cover more on WML and WMLScript in later sections.

The WAP protocol stack

To minimize bandwidth requirements, and guarantee that a variety of wireless networks can run WAP applications, a new lightweight protocol stack called the WAP protocol stack was developed. Figure 3 illustrates this stack protocol and also shows a comparison to a Web-based protocol stack. (The layer acronyms can be translated to Wireless Application Environment, Wireless Session Protocol, Wireless Transaction Protocol, Wireless Transport Layer Security, and Wireless Datagram Protocol, respectively).

Figure 3. The WAP protocol stack

The WAP protocol stack has four layers: session layer, transaction layer, security layer, and datagram layer. Note that the WAP protocol is designed to operate over a variety of bearer services, including Code Division Multiple Access (CDMA), Cellular Digital Packet Data (CDPD), and so forth.

WML

The Wireless Markup Language (WML) is an XML-based markup language that was designed to describe how WAP content is presented on a wireless terminal. WML differs from HTML in the following:

  • WML was specifically designed for wireless terminals with a target screen that is only a few lines long and about an inch wide.
  • WML is case sensitive, and all tags and attributes should be in lowercase.
  • Unlike HTML, WML is unforgiving of incorrectly nested tags.
  • WML doesn't assume that a "QWERTY" keyboard or a mouse is available for user input.


Based on these differences, WML provides a smaller, telephony-aware set of tags that make it more appropriate than HTML for handheld wireless terminals. Similar to HTML, though, with WML you can give the user input options and specify how the user agent should respond when, for example, the user presses a key.

  • Digg
  • Reddit
  • SlashDot
  • Stumble
  • del.icio.us
  • Technorati
  • dzone
Comment
Login
Forgot your account info?
Add comment
Anonymous comments subject to approval. Register here for member benefits.
Have a JavaWorld account? Log in here. Register now for a free account.
Resources