Apache in a Wireless World
August 17, 2000
Originally appearing in WebCompare.
Wireless Internet access has the opportunity to serve, literally, every person everywhere. Delivering wireless content to cellular phones and PDAs is similar to but not exactly the same as serving traditional Internet content. Because of these products' limited physical size and communications speeds, new protocols have been developed to package the Web for the wireless world. WAP and WML are the backbones of wireless Web. Placing the Apache Web server into this picture is a natural and easy fit.
While configuring Apache to deliver wireless data is relatively simple, as we will discuss shortly, it is helpful to understand the context of the issues surrounding wireless content delivery.
Land-based Internet communications move data around the world using the TCP/IP protocol. This protocol helps "packets" of data navigate the complex routes across networks, changing paths where necessary to maintain traffic flow across the system. Vendors of wireless communications devices, including such heavyweights as Nokia and Motorola, realized that a data routing system was necessary to push information across wireless networks, which operate with different principles and constraints than physical land lines.
Thus was born the Wireless Application Protocol, or WAP. WAP was designed to push data across the many various types of wireless network topographies in a secure manner, since the wireless space is inherently more vulnerable to eavesdropping than are physical connections. Any operating system can theoretically support WAP. However, the reality is that most devices that will require WAP capabilities will be small in their physical size, like mobile phones and hand-held PDA-style machines.
The consequence of WAP devices' small size is that although WAP as a protocol is perfectly capable of pushing existing data formats such as HTML, these devices are essentially too constrained to properly render documents encoded in these formats, which have been developed with desktop monitors in mind. A companion to WAP was needed then, as well as a defined document format that would render sensibly in the constrained space of small wireless devices.
"And so as wireless begat WAP, WAP in turn begat WML ...", as they might have said in Biblical times had they been writing about content delivery over wireless networks. The Wireless Markup Language, WML, will strike a familiar chord to anyone who has ever worked with the HTML behind most Web pages. In fact, WML is a specific implementation of XML, defining a markup syntax and structure with which users can design pages suitable for a small device.
HTML and WML operate on slightly different underlying metaphors. Whereas HTML is premised on the now-ubiquitous "page" metaphor, WML rests on a "deck of cards" metaphor. Typically, an HTML document represents a single Web page, but a WML document represents a deck within which there can be one or more cards. Navigation within the deck consists primarily of flipping between cards in the deck, either in sequence or via hyperlinks.
Remember that the driving force behind WML is that a wireless device has a small, often tiny, screen and cannot display very much information -- sometimes as little as four or five lines of text. Thus, there's no real space for graphics other than the occasional small logo, most text is the same size, and the screen is often monochrome. So, the real strength in wireless networking is not the capability to replicate land-based Web surfing on the street or in the air, but to target small, focused pieces of data, such as a weather report, a sports score, or a travel reservation.
Like HTML, a WML document is a text document when created as source code. Although this is not a WML tutorial, per se, let's look at a simple WML deck of cards, to get a feel for the type of data that Apache will deliver to wireless devices. We'll set up a WML deck with two cards: the first with a greeting and a link to the second card, the second with some very fictitious "favorite WML pages".
By and large, the Web server doesn't need much tweaking to deliver WML pages to a wireless device. As far as Apache is concerned, it needs only to know how to recognize the MIME type of the file, based on the file's file name extension. Apache will pass this MIME type to the receiving browser and, assuming the browser knows WML, it will know what to do with a WML type file.
Recent versions of Apache can be entirely configured through the file httpd.conf, which is typically located in the apache/conf/ directory, wherever Apache is installed on the server. If you open httpd.conf in a text editor, you can scroll through and view the many, many Apache configuration directives. Ultimately, you will find a section where MIME types are declared. In the default Apache httpd.conf file, this section begins as follows (though it may vary slightly depending on the installation):
# # AddType allows you to tweak mime.types without actually editing it, or to # make certain files to be certain types. # # For example, the PHP3 module (not part of the Apache distribution) # will typically use: # #AddType application/x-httpd-php3 .phtml #AddType application/x-httpd-php3-source .phps AddType application/x-tar .tgz
While not strictly necessary, this is a good and logical place to add WML types to Apache. So, we simply pasted the following lines to our httpd.conf file just after the last line above:
#WML/WAP types AddType text/vnd.wap.wml .wml AddType application/vnd.wap.wmlc .wmlc AddType text/vnd.wap.wmlscript .wmls AddType application/vnd.wap.wmlscriptc .wmlsc AddType image/vnd.wap.wbmp .wbmp