In this second installment, I’ll present an example of porting data to a WAP phone emulator using Microsoft SQL 7.0. You can download the sample code used in the example in .zip format from the Go To Public Files link on my NetDrive Web site. Note that this article assumes a prior knowledge of ASP (Active Server Pages).
First things first—you need a WAP emulator
As explained in part 1, there are three components used in a WAP (Wireless Application Protocol) application: a WAP device, a gateway, and an application server. However, by using a WAP emulator, we can emulate the mobile phone and the gateway on a PC. For this example, I am using a Nokia WAP Emulator Toolkit v1.2, which can be downloaded free from the Nokia Web site. To run the emulator smoothly, your system should meet the following requirements:
- The operating system should be either Windows NT 4.0 with Service Pack 3 (or later) or Win9x.
- The PC should have a 266-MHz or higher processor, a 20-MB hard drive, and 64-MB RAM.
- The display should be capable of showing 65,000 or more colors.
- You must have Java Runtime Environment 1.2.2 or later (available here) loaded on the machine.
- You’ll need a virtual directory (or a Web site) on a server having MIME (Multipurpose Internet Mail Extensions) settings as described in Table A.
|Content type||MIME type||Extension|
|WML source||text/vnd.wap.wml wml||wml|
|Wireless bitmaps||image/vnd.wap.wbmp wbmp||wbmp|
|Compiled WML||application/vnd.wap.wmlc wmlc||wmlc|
|WMLScript source||text/vnd.wap.wmlscript wmls||wmls|
|Compiled WMLScript||application/vnd.wap.wmlscriptc wmlsc||wmlsc|
These MIME types can be set on an Internet Information Server as follows:
Start > Programs > Windows NT 4.0 Option Pack > Microsoft Internet Information Server > Internet Service Manager > Right-click on a Web site or folder you want to set MIME > Properties > HTTP Headers > File Types
For information on the settings for a Personal Web Server (PWS), check out this Microsoft KnowledgeBase article on adding MIME types to PWS.
Next comes the database structure
For this example, we will be searching for books by author name in a library database. The database structure consists of three tables: tblAuthor, tblBooks, and tblAuthBooks. We’ll assume that there is one author to a book, although one author can be associated with many books.
You can download the sample code for the ASP files and SQL Script in .zip format from the Go To Public Files link on my NetDrive Web site. Here’s a brief description of the files included in the .zip:
This file retrieves all the authors from the tblAuthor table and shows their names in a list. When a user selects an author, this file posts the Author_ID to the file Search_Result.asp.
This file retrieves all the books written by the authors and shows their names in a list. When a user selects a book, this file posts the Book_ID to the file Book_Detail.asp.
This file shows details about the book.
This file contains script to create tables and other stored procedures.
So how do we run this program?
The steps to run our program appear below:
- Run the wap.txt file in a database program and change the username to the appropriate person who has rights to table creation.
- Add records to the tables.
- Make appropriate changes for database name, server name, username, and password in the connection string of all the ASP files.
- Copy the ASP files into the virtual directory using the correct MIME settings.
- Run the Nokia toolkit you downloaded earlier and type in the URL of the file Book_Search.asp. If you are running the emulator from a local PC, the address may look something like: http://localhost/wap/Book_Search.asp.
- Select an author and hit Submit.
- Select a book and hit Submit again. You should now see details about the book.
By making the database structure more complex, this seemingly simple application can become very powerful. If we just incorporate input fields for book names, ISBN, price, and so on, we can make searching more effective. Also, the Nokia Development Toolkit contains a WBMP (Wireless Bitmap) editor that can be used to create, open, modify, and import images and convert them into WBMP. These bitmaps can enhance the look and feel of the WAP application.
The opportunities made possible by WAP phone technology are hard to overlook. As more and more employees become mobile, applications that use this technology will definitely increase. As a network administrator, a good understanding of how this technology can benefit your enterprise will keep you one step ahead in the technology revolution.
If you'd like to share your opinion, please post a comment below or send the editor an e-mail.