Originally Published: Wednesday, 22 August 2001 Author: S.D. Campbell
Published to: develop_articles/Development Articles Page: 1/1 - [Std View]

WAP and the Wireless Web for Linux

Linux.com presents an introduction to WAP and WML development with Linux for the home hacker and enthusiast. In this, the first of three articles, Sean Campbell takes a look at the WAP protocols and environment and gets busy with setting up a Linux web server to serve WML script.

WAP is one of the technologies being implemented to bring the web to the wireless world. WAP stands for Wireless Application Protocol, and it's one way to present hypertext data to a wireless browser, like those on cellular phones or PDAs.

To understand how this wireless web technology works, its best to see it from three distinct angles: how the architecture transmits web pages to wireless devices; how you can create such a wireless web page, and how to introduce interactivity to those web pages.

Part I: WAP - The Wireless Web's Architecture

WAP is designed to bring simple web-based functionality to cell phones and palmtops. Like Internet professionals and web developers need an understanding of how the Internet and Web work, so too do WAP developers need an understanding of the underlying protocols and systems that make the wireless web work.

The key to WAP is a micro-browser. This is the web browser embedded in WAP-enabled devices, and this is the browser that renders WML and WMLScript and provides the user interface to all WAP applications. It isn't necessary to have a WAP-enabled device to view WML pages, however. Several development environments exist for the PC platform, and these include their own WAP browsers. Unfortunately, most of these IDEs were developed for Wintel systems, and those of us who prefer to use Linux as a development platform will find our IDE selections limited. As we'll see in parts two and three of this series code development for WAP is as simple as using your favorite text editor.

To view WAP pages on a Linux system I do recommend an Open Source, Java-based solution called Waplet, which is available on Sourceforge at: http://waplet.sourceforge.net

The other two parts of the WAP equation reside in the realm where Linux works best-the server environment.

Two types of servers are required to make WAP work as it is designed to. The first type is called a WAP gateway server, and like any gateway it is designed to translate messages between two different types of networks. In this case a WAP gateway translates between the IP packet world of the Internet, and a wireless phone/data network, which is a different beast all together.

The wireless world deals with such problems as small bandwidth and high latency, problems that for the most part the Internet doesn't get itself too concerned about. TCP/IP is in fact a protocol with a very high overhead-consider for example a simple TCP handshake: A SYN packet is transmitted from the client to server, the server acknowledges with a SYN-ACK, and the client transmits its own ACK. This kind of handshake over a cell phone would be very wasteful, and so wireless networks rely on slim protocols.

Where the Internet excels is in the use of HTTP to transmit hypertextual data, and WAP leverages these protocols through the use of a WAP gateway.

WAP gateways are very complex pieces of software, and would hardly be the sort of thing a home Linux enthusiast would likely toy with. They're usually put in place by large wireless network providers. Yet while the big wireless names like Ericsson and Nokia produce their own gateway software, there is an interesting Open Source WAP gateway called Kannel located at http://www.kannel.org which is designed to run on a simple Linux box.

Unlike gateways though, a simple web server would not be beyond the interests of most Linux people. Because WAP does leverage the HTTP 1.1 protocol for its session layer (in the guise of a protocol called WSP), it is child's play to set up a web server to serve WAP documents. The key is in the configuration of the MIME types your web server will be transmitting. Beyond WML and WMLScript document, WAP-enabled web servers must be able to serve a WBMP, or wireless bitmap-the image format used in WAP-as well as binary versions of WML and WMLScript. For efficiency sake, WAP documents are often 'compiled' into a smaller binary format before they are transmitted, and these binaries must also be supported by the web server.

To do this you would have to add the following five mime types to your server configuration (on Apache they would be added to mime types file in the configuration directory):

text/vnd.wap.wml		wml
text/vnd.wap.wmlscript		wmls
image/vnd.wap.wbmp		wbmp
application/vnd.wap.wmlc	wmlc
application/vnd.wap.wmlscriptc	wmlsc

Once the server has been restarted, it should be ready, willing and able to transmit WML, WMLScript and WBMP documents upon request.

Once you've installed Waplet, and have access to a web server that can serve WAP document, you're ready to move forward with the development of your own WAP pages. Developing WML decks will be covered in the next part of this series, and we'll look at creating interactive pages with WMLScript in the final installment.

Sean Campbell (I-Net+, CIWA) is a web developer, programmer and technical writer, and has worked in the IT industry in one capacity or another for almost ten years. He currently teaches Web Design and Development at Applied Multimedia Training Centers. In addition to his programming and technical writing background, Sean - a native of Prince Edward Island - has been known to publish fiction, and non-fiction on the web. He lives in Calgary, Alberta, Canada with his wife, Christina and a psychotic German Shepherd named Phelan. His webpage can be viewed at: http://www.spots.ab.ca/~whytwolf/