Browsing an LDAP Directory with WAP

by Albert Proust and Thomas Larzilliere

What is WAP?

The Wireless Application Protocol (WAP) enables wireless devices to access Internet applications and content through a WAP gateway, offering exciting new opportunities for client/server applications. To illustrate why this technology is a boon to mobile application development, we present a solution that relies on this new technology to access our company's intranet phone directory from a WAP phone. The model in this article solves a simple problem: How can we find a co-worker's phone number without having to store this data in the mobile phone's directory?

The Solution

As seen in the figure below, we used the company's LDAP (Lightweight Directory Access Protocol) directory to access the phone number through an Apache Web server, the JRun servlet engine, and a WAP gateway. To ensure security, we connected ourselves directly to the computer where the WAP gateway is hosted. Because our servers are not accessible from the Internet, we need this gateway to reach our application.

Figure 1 : WAP-LDAP architecture configuration

Figure 1 : WAP-LDAP architecture configuration.

Advantages of Using WAP

This solution illustrates the advantages of using WAP. We simply input the name of the person we want to call into the user interface, and the search function returns the full name and the phone number, as shown in figure 2. If the phone has an auto-dial feature, we can use the call button to call automatically. This eliminates the need to store the phone number in the telephone's memory, although frequently used phone numbers may be stored for later use.


Learning WML and WMLScript

Learning WML & WMLScript
By Martin Frost

Sample: Chapter 3: WML Tasks and Events

See also: WML and WMLScript Tips & Tricks

Figure 2 : Five steps to get a phone number.

Figure 2 : Five steps to get a phone number.

Because the phone's memory capacity to store phone numbers is limited (about 100 numbers), it would be impossible to store all valid phone numbers for a company of 1,000 employees or more. This solution requires the company to maintain phone-number information -- not the end user -- ensuring that phone numbers are always up to date. If an employee changes office, the company will update the telephone number in the LDAP database.

Our phone-number retrieval application uses Java servlets and JSP to deliver content. After connecting to the LDAP server, this technology allows the application to generate WML (Wireless Markup Language) code as easily as HTML. Like an HTML browser, the WAP device sends a request to the HTTP server across the gateway. The server executes the request, and employs Java, Java server pages (JSP), and JNDI (Java Naming and Directory Interface) to format the answer. It then sends this answer back to the mobile device. But WAP technology does have its limitations and there is an art to developing effective applications for wireless devices. Entering a name on a numeric pad is not easy, so the most effective navigation strategies ensure that users don't have to press a lot of buttons.

In HTML environments, the memory of the computer is generally large enough to send a complete answer to a problem, but in WAP environments, you can't send more than 1,397 kilobytes at a time. WAP-devices must break documents down into 1,397 Kbyte packets before sending them. Also, HTML browsers are often device-specific, and each WAP device has its own WML user interface. One device might ignore <bold> tags; a second might ignore <table> tags. The application must know which WML interface to use for any given device.

WAP Gateway

The WAP gateway is the key element of any Internet or intranet system connected to the wireless network. It ensures the connection and conversion of information between WAP-enabled devices and the Web server. Documents intended for wireless devices are encoded by the gateway according to specifications developed by the WAP Forum (Ericsson, Nokia, Motorola, and about 200 other interested companies). To reduce the size of the transmitted data, the requests and the answers are encoded in a compact binary format. The WAP format files are compiled by the gateway before being sent to the terminal that decodes and interprets these files.

A WAP gateway can built into an application server. This makes it possible to offer complementary services and generate documents for specific mobile phone. Nokia's WAP gateway, for example, uses servlets and scripts to generate WAP content on demand. Several manufacturers such as Nokia, Ericsson, and Motorola sell their own WAP gateway. But other companies like Audicode and DSR provide independent WAP gateway services with secure transaction support using the WTLS (Wireless Transport Layer Secure) protocol.

The WAP gateway used in this solution, Kannel WAP gateway, is open source software. Its evolution is very fast and it runs under Linux and Sun Solaris operating systems. It supports WML, WMLScript, WTAI (Wireless Telephony Application Interface) commands, and SMS.


The Wireless Application Protocol makes it possible to develop Internet content for a variety of mobile devices. This opens the door for new value-added services for mobile devices. In this example, we presented an application that uses an LDAP server connection to retrieve data, but it is easy to imagine other new uses for this technology such as accessing remote administration systems, reading and sending e-mail messages from wireless devices, or managing a stock portfolio from a mobile phone.

Albert Proust is co-authoring a book on WAP for O'Reilly Media, Inc..

Thomas Larzilliere works for Sun Microsystems in Paris and is co-authoring a book on WAP for O'Reilly Media, Inc..

Discuss this article in the O'Reilly Network Wireless Forum.

Return to the Wireless DevCenter.