Book HomeWeb Design in a NutshellSearch this book

Chapter 32. WAP and WML

Contents:

About WAP
Creating WAP Applications
Introduction to WML
WML Elements and Attributes
WAP and WML Resources

Both mobile devices and the Internet have exploded into widespread use in the past few years, so it stands to reason that the two would be combined. One technology for delivering information to wireless devices (primarily mobile phones, but also pagers and personal digital assistants) is WAP, the Wireless Application Protocol. WAP is a collection of protocols and specifications that work together to give mobile phones access to Internet-like information.

One part of the WAP standard is the Wireless Markup Language (WML), which is used to create wireless applications just as HTML is used to create web pages. WML is an application of XML, meaning that it is defined in a document type definition, or DTD (for more information on XML, see Chapter 30, "Introduction to XML").

The goal of WAP is not to port existing web sites onto mobile phones, because the small screen size and limited bandwidth make that impractical. Rather, it is a system for creating special applications tailored to handheld devices. That is why you often see the phrase "Internet-like information" used in regards to WAP. WAP is good for delivering short, pithy bits of data, such as stock prices, sports scores, movie times, and so on. It is not useful for the complex documents with visual layouts that have made the World Wide Web what it is today.

Many traditional web designers feel pressure to keep up with the Web as it extends into the world of wireless devices. The truth is that unless you make a career shift into wireless application development, it is unlikely that you will be required to design specifically for handheld devices. Still, it is helpful to be familiar with the basics of what is going on in the wireless space.

This chapter begins with a brief introduction to WAP and application development. The second half focuses on WML and how it works, including a summary of the elements and attributes in the current WML specification.

32.1. About WAP

As I just mentioned, WAP is not a single entity, but rather a list of protocols and specifications. It is being developed under the guidance of the Wireless Application Protocol Forum, originally founded by wireless industry leaders Nokia, Motorola, Ericsson, and Unwired Planet (which evolved into Phone.com and is currently Openwave). The WAP Forum web site (http://www.wapforum.org) is a good resource for the current state of wireless communications, including the complete WAP specification documents.

32.1.1. The Wireless Environment

WAP addresses the special limitations and requirements of mobile phones and similar devices. The distinguishing characteristics are:

  • Small screen size. Only a small amount of information can be displayed at once.

  • Limited processing power.

  • Lack of a full keyboard, making it awkward for the user to enter information. There are some handheld devices that feature a full keyboard, but they are the exception.

  • Slow connection speeds. Currently, wireless connection speeds are around 9600 bits per second.

  • Costly access. Users are generally paying by the minute or the kilobyte to use a wireless application. It is important to allow them to access information quickly.

All of these factors guide the development of WAP technology and the design process of WAP application developers.

Alternatives to WAP

While WAP is gaining worldwide support, it is not the only system out there for delivering information to wireless devices. Before WAP, pages were delivered using HTTP connections and a mobile-friendly markup language called HDML (see the sidebar "About HDML" later in this chapter). Many phones still support standard HTML content.

iMode (created by NTT DoCoMo, http://www.nttdocomo.com) is another wireless communication system that has taken off like wildfire in Japan. iMode phones typically have full-color displays that are capable of displaying graphical layouts and even games. iMode documents are created using a subset of HTML elements (see http://www.nttdocomo.com/i/tag/index.html for a complete list).

Many people see the current version of WAP as an interim solution that will eventually be replaced by IPv6 on the protocol side and XML on the markup side. Of course, in the telecom world, once an interim solution gets out in the market, it can have a surprisingly long life, so WAP as it stands today is likely to be around for a while.

32.1.2. How WAP Works

A WAP application is formatted using WML and WMLScript, the scripting language for adding interactivity to wireless applications. These files can be served from an ordinary HTTP (web) server.

WAP-enabled devices communicate with the web server through a WAP gateway (Figure 32-1). The gateway acts as an intermediary between the Internet and the mobile network, converting WAP requests into HTTP requests. A wireless device (such as a mobile phone) requests information via the airwaves to the gateway. The gateway uses the Internet via HTTP to request and receive a WML document from the web server.

Figure 32-1

Figure 32-1. Mobile devices access web servers through a gateway

Upon arriving at the gateway, the document gets compiled into WAP Binary XML ( WBXML) before it is sent to the phone. The compilation process reduces the file size by replacing tags with specific single-character codes, and removing comments and extra white space. Once the document has been compiled, it is returned via the airwaves to the mobile phone.

WAP gateways are normally owned by wireless service providers, so you don't need your own gateway to provide WAP applications (unless you're a bank or some similar institution of means). You can serve your content from a regular, properly configured web server. The WAP gateway will find your information as any other web client would.

32.1.3. Serving WAP Content

In order to serve the documents necessary for a WAP application, you need to configure the server to recognize a few new MIME (file) types, listed in Table 32-1. MIME types are explained in Chapter 4, "A Beginner's Guide to the Server". Follow the instructions for your particular server for installing new file types.

Table 32-1. WAP-related MIME types

Description

MIME type

Extension

WML file

text/vnd.wap.wml

.wml

Compiled WML file

application/vnd.wap.wmlc

.wmlc

WMLScript file

text/vnd.wap.wmlscript

.wmls

Compiled WMLScript file

application/vnd.wap.wmlscriptc

.wmlsc

Wireless Bitmap Image

image/vnd.wap.wbmp

.wbmp



Library Navigation Links

Copyright © 2002 O'Reilly & Associates. All rights reserved.