Chapter 32. WAP and WML
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:
All of these factors guide the development of WAP technology and the design process of WAP application developers.
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. 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
Copyright © 2002 O'Reilly & Associates. All rights reserved.