The wireless Internet is one of the most revolutionary and promising developments in IT. Getting Started with WAP and WML is the most effective resource for Web programmers who want to develop WAP applications. Inside, a telecommunications engineer and an information designer combine more than two decades of experience to teach you the ins and outs of the Wireless Application Protocol and WML, the markup language that lets you build remarkably functional applications for wireless handheld devices.
- Understanding WAP and WML
- Building simple WML pages
- Adding practical functionality
- Using WMLScript to make your pages intelligent
- Fine-tuning your applications
- Making your service dynamic
- Internationalizing your WAP service
- Accommodating device limitations
- Taking advantage of specific device features
Read an Excerpt
Chapter 1: Introducing WAP and WMLThis chapter introduces you to the Wireless Application Protocol (WAP) and the key markup language you'll need to grasp to develop content for WAP-enabled wireless devices. This language, called Wireless Markup Language (WML), is supplemented by its own scripting language, called WMLScript, which will be introduced before a discussion on WAP architecture, standards, devices, and what the future holds in this fast-moving technological environment.
What Is WAP?Wireless Application Protocol (WAP) is a set of standards designed to extend Internet services to mobile phones, pagers, and personal digital assistants (PDAs). The development of WAP is coordinated by an industry-wide group of companies under the banner of the WAP Forum. The WAP Forum was created to apply the best principles of Internet application development to the wireless environment. See the sidebar later in this chapter for more on the WAP Forum.
WAP has become the de facto worldwide standard for the presentation and delivery of wireless information and telephony services on mobile phones and other wireless devices. It is an open protocol that provides the same development standards to all vendors irrespective of the underlying network system. It is designed to work under the low bandwidth constraints of wireless networks. These constraints are currently around 10Kbps compared with the standard 56Kbps on home computers using domestic telephone lines with standard dial-up modems. As most wireless computing devices have limited processing power and memory, and are designed with screen displays and small multifunction keypads, WAP was developed with these limitations in mind. WAP was created to address three main issues related to data communications across wireless net-works: low bandwidth, high latency, and connection availability.
Because WAP is an open protocol, a number of manufacturers are producing a wide range of WAP-enabled devices. These manufacturers in turn are able to source from a large range of WAP-specified components because the server technology is also open. This general openness and adoption of common standards means that developers, manufacturers, and content providers are able to adopt WAP with confidence and benefit from the economies of scale.
WAP uses a client/server architecture that employs an unsophisticated wireless-based microbrowser and requires only limited resources and a WAP gateway to deliver content from the server where it is stored. It is a standard independent of the air interface, the user interface, and the underlying data bearer. Therefore, it is entirely interoperable. Because WAP is based on existing Internet technologies, it leverages the massive investment in similar conventional Web tools, applications, servers, and their developers while considering the restricted bandwidth, processing power, and memory currently available on wireless portable devices.
Web content is available over existing wireless communication networks through a WAP gateway. Figure 1.1 illustrates how an established WWW infrastructure, based on the Hypertext Transfer Protocol (HTTP), uses a WAP gateway to interface with the wireless network by translating HTTP requests into wireless device requests.
The 1997 WAP Forum specification is unique in that it is truly global and spans the numerous airlink standards. WAP specifies guidelines for the implementation of microbrowsers and the network-resident servers that connect portable wireless devices to the network infrastructure and the Web. For the carriers, the creation of WAP means minimum risk and investment, new sources of revenue, and a more attractive, comprehensive suite of value-added services. For users, it provides easy access via WAP-enabled handheld devices to the Web and secure access to corporate intranets. Manufacturers also benefit from the provision of a global, open, de facto standard. They're provided with a complete new range of marketing opportunities and revenue streams, while the content providers and develop-ers are confronted with the huge untapped market of wireless customers and the prospect of 100 million WAP-enabled devices by mid-2001.
What Is WML?Wireless Markup Language (WML) is to WAP and its handheld devices what Hypertext Markup Language (HTML) is to the Web and browsers such as Netscape and Internet Explorer. It describes how content is presented to the wireless device, allowing you to display information, present input options, and tell user agents (programs that interpret WML, WMLScript, and other forms of code—typically a microbrowser in a mobile phone) how to respond once an option has been selected using the keypad.
WML is a subset or an application of the eXtensible Markup Language (XML), and because WAP uses a similar model as the Internet, it allows content developers to quickly become proficient with this relatively simple tag-based language while allowing a clear development path. WML is based on the World Wide Web Consortium (W3C) guidelines for wireless access and works similarly to HTML to deliver Web text using simple markup tags.
WML's user interface is a WAP microbrowser optimized to map onto mobile wireless devices. AWMLdocument is called a deck, which is comparable to an HTML page. Unlike the flat structure of HTML content, WML documents—or decks—are divided into separate units of user interaction. Each unit is called a card, and WAP services are created by letting the user navigate between the cards of one or more decks in much the same way hyperlinks are used within and between HTML documents.
WAP gateways provide the interface between the network and Internet or intranet services. From this gateway, WML content is accessed over the Internet using the standard HTTP mechanism.
WAP developers and content providers can get up to speed quickly with WML, as it follows the same programming model as the Web development model. It is a tag-based language specified as an XML document type, so all existing XML tools and some HTML development environments can be used to develop WAP applications. As standard HTTP is used for communication between gateway and servers, developers can use off-the-shelf Web servers to deploy their applications. Standard tools such as ColdFusion and CGI scripting languages such as Perl, PHP, and ASP generate content for dynamic WML applications.
The WML specification was developed by the WAP Forum and defines the syntax, variables, and elements to be used in a valid WML file. The WML 1.1 Document Type Definition (DTD) is available from www.wapforum.org/DTD/wml_1.1.xml , and all WML applications must correspond to it. The microbrowser that all WAP-compliant wireless devices are loaded with is able to handle all entities in the WML1.1 DTD.
The WAP gateway translates wireless device requests into HTTP requests and then redirects the Web server's HTTP responses to the device. WML files being sent to WAP-enabled handheld devices are compressed into a binary format by the WAP gateway. It is possible to translate HTML into WML using a number of available filter tools, but in practice, the differing user interfaces employed between the desktop and wireless environments make specific WML-tailored solutions the norm.
AWAP emulator is a program that implements a WAP microbrowser, but is designed to run on a non-WAP device, such as a Windows PC. Emulators are often used by developers to speed up the development process, as well as to reduce the costs of using WAP during testing each time a change is made. They are also useful to see how a real WAP device will look, because many of these emulators mimic the look and feel of real WAP devices. Alist of available emulators is provided in later chapters. When a WAP emulator is used, a WAP gateway is not required because WML files are downloaded from a Web server or local file, and the emulator renders it in the Emulator window. Figure 1.2 shows this process.
Applications and services written in WML become available to all network devices that are WAP compliant, delivering a write once, use anywhere tool. WML developers can map soft keys (appropriated to physical keys on the WAP-enabled device by the manufacturer) for easy user input and take advantage of features designed to maximize the effect of displaying text on a limited screen. Low-resolution graphics known as WBMPs can be used, and as bandwidth increases, so too will the resolution of the graphics supported by the WAP specification. As long as a recipient device is WAP compliant, the size of the device's display is automatically accounted for by the microbrowser and the use of standard HTTP header mechanisms to learn about a device's capabilities. These header mechanisms allow the developer to customize applications to take advantage of different device characteristics. This technique is known as device sensing and is the same in principle as the HTML of many Web sites that detect which Web browser and version you are running to provide an optimal display and to allow support for browser-specific features.
While WML is good at things like event processing, input and output handling, and rendering, it has no practical processing abilities. It is, therefore, supplemented by the WMLScript scripting language.
WMLScript enhances the capabilities of WML in a number of ways. With it, you can access user agent facilities, check user input, generate local messages and dialogs, and execute user agent software.
This functionality allows you to locally program things like error messages and alerts for faster viewing, add to your wireless address book, and interrogate SIM cards.
WMLScript defines functions containing flow control logic constructs such as while, if, and for, which can be called from the main body of the WML program....
Table of ContentsIntroduction
Chapter 1: Introducing WAP and WML
Chapter 2: Getting Started
Chapter 3: Your First WML Pages
Chapter 4: Spicing It Up
Chapter 5: Adding Intelligence with WMLScript
Chapter 6: Tuning Your Service
Chapter 7: Making Your Service Dynamic
Chapter 8: Internationalizing Your WAP Service
Appendix A: WML Elements
Appendix B: WMLScript Reference
Appendix C: ISO 639 Two-Letter Language Codes
Appendix D: ISO 3166 Two-Letter Country Codes