O'Reilly logo

Learning WML, and WMLScript by Martin Frost

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required


The Wireless Application Protocol (WAP) is an industry-wide specification for applications that operate over wireless networks, with particular emphasis on applications for mobile devices, especially mobile phones. The standards are published by the WAP Forum, a body formed in June 1997 by Ericsson, Nokia, Motorola, and Unwired Planet, which has since been joined by over a hundred other companies, including IBM, Hewlett-Packard, Visa, and Microsoft. According to the WAP Forum’s official statistics, WAP Forum members represent over 90% of cellular-phone manufacturers worldwide.

WAP will be supported by many kinds of devices, from simple cell phones similar to those available today to a new generation of “smart” phones with large touch screens and many applications of their own. That’s before we even look at the range of personal digital assistants (PDAs) available, from palmtops to full miniaturized computers complete with keyboards. All will eventually get WAP capabilities, either directly from the manufacturer or as some sort of third-party upgrade. Each device has a different kind of display and different methods for user input. The job of the WAP specification is to sort out this mess and provide a common framework to allow applications to run across all these different platforms.

Since WAP works in a mobile environment, it also has to contend with the particular problems of wireless networks: low bandwidth (9600 bps or less is commonplace), high latency (round-trip times of the order of seconds are not uncommon), and unreliability (someone may be using her WAP phone when the train goes into a tunnel or when she walks past a tall building). Everyone with a mobile phone knows about the reliability problems.

These problems are why WAP is necessary. Some people may ask why they can’t just have normal web pages delivered over normal TCP/IP connections, the only difference from their PCs at home being the wireless link. The trouble with the normal web technologies is that they are aimed at high bandwidth and big screens. WAP keeps the Internet model but optimizes each component for a mobile environment. It keeps track of the state of a session in case the connection is lost, provides compressed formats for the transferred data, and handles displaying of applications regardless of the input and output available.

The WAP Stack

The term that refers to all the different parts of the WAP specifications is the WAP stack . This is because the components can conceptually be thought of as layers in a stack. The user interacts with the top of the stack, and the communications hardware sits below the lowest level. This concept is illustrated in Figure 0.1, together with the names of the various specifications involved.

The WAP stack

Figure 1. The WAP stack

Going from bottom to top, the lowest layer in the figure contains various protocols (the so-called bearer protocols), which aren’t actually part of WAP but which provide the link between WAP and the actual communications hardware:

  • IP (Internet Protocol) and PPP (Point to Point Protocol) are the two lowest-level protocols in normal dialup Internet access. (Many first-generation WAP devices work by making a normal dialup call and sending the WAP data across a modem link. IP and PPP are used in such a case.)

  • SMS (Short Message Service) is a feature provided by most digital mobile phone systems that allows short messages to be sent and received across the wireless link. (Users see this as the ability to send short text messages—a bit like email.) It can also transmit binary data and be used for WAP.

  • GPRS (General Packet Radio System) is a next-generation mobile phone system that will bring higher bandwidth and permanent network connections to cell phones and other wireless devices. Instead of having to dial into the server, a cell phone will effectively have a permanent Internet connection. GPRS is based on IP.

The next layer up includes various low-level WAP communications protocols: WTP (Wireless Transaction Protocol), WTLS (Wireless Transaction Layer Security), and WDP (Wireless Datagram Protocol). WTP and WDP provide low-level glue between the upper levels and the really low-level communications. WTLS provides security services (encryption and authentication). These protocols aren’t relevant to normal application programmers: unless you’re designing a browser, you don’t need to know about them.

The second highest level in the stack is the high-level communications protocol, called WSP (Wireless Session Protocol). This provides a complete replacement for HTTP (HyperText Transfer Protocol), which is the protocol used between web servers and web browsers. Although you don’t need to know how this layer works, there are one or two features that may be directly useful: these are described in Appendix B.

The highest stack level is the WAE (Wireless Application Environment), which is the part that the user actually sees and with which she interacts. The WAE aims to provide a World Wide Web-like model for writing applications, allowing existing web developers to ease the transition to producing content and applications for mobile devices.

To achieve this, the WAE incorporates several key features of the Web that you’ll be familiar with, including URLs (like http://www.wap.net) and MIME content types (such as text/html and image/gif. Additionally, it provides similar replacements for other features: HTML is replaced with WML (Wireless Markup Language), and JavaScript is replaced with WMLScript (Wireless Markup Language Script). Almost all WAP applications can be written without using anything outside of these two languages and WBMP (Wireless Bitmap: the WAP image format), so they form the vast majority of what you as a developer need to know (and the vast majority of this book!).

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required