Many of us have become enamored with wireless devices. I’m addicted to my BlackBerry, and others I work with swear by their iPAQs or Jornadas. Wireless email is great, but I’m really looking for something else—a traffic update while I’m driving to work, for example. Some of us use wireless devices that offer full-blown browsers that can render almost any Web page (if you’re more patient than I am, this is a great feature). Some of us have Wireless Access Protocol-enabled (WAP-enabled) our cell phones, but the extremely small real estate on this device limits the amount of information that we can view at a time. Enter the wireless markup language (WML).
If you know HTML, you already know WML. WML is simple, and it follows the XML standard. A WML file travels to a WAP-enabled device just like an HTML page travels to your browser: A Web server receives a request for a file and serves the file to the client.
Below is a simple WML file we created to enter information about new recruits into our existing recruiting system. We wanted to add functionality to our Web-based recruiting application so that if employees encounter potential candidates for employment and they want credit for the referrals, they can use their WAP-enabled cell phones (or other devices) to enter the candidates into the system.
<?xml version="1.0"?> <!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml"> <wml> <head> <meta http-equiv="Cache-Control" content="max-age=30" forua="true" /> </head> <template> <do type="options" label="Main"> <go href="default.wml" /> </do> </template> <card id="card0" title="Add New Recruit"> <p align="left">Last Name:<br /><input type="text" name="LName"/></p> <p align="left">First Name:<br /><input type="text" name="FName"/></p> <p align="left">EMail:<br /><input type="text" name="EMail"/></p> <p align="left">Work Phone:<br /><input type="text" name="WPhone"/></p> <p align="left">Home Phone:<br /><input type="text" name="HPhone"/></p> <p align="left">Cell Phone:<br /><input type="text" name="Cell"/></p> <p align="left">Notes:<br /><input type="text" name="Notes"/></p> <do type="accept" label="Submit"> <go href="insertrecruit.asp" method="post"> <postfield name="LName" value="$LName" /> <postfield name="FName" value="$FName" /> <postfield name="EMail" value="$EMail" /> <postfield name="WPhone" value="$WPhone" /> <postfield name="HPhone" value="$HPhone" /> <postfield name="Cell" value="$Cell" /> <postfield name="Notes" value="$Notes" /> </go> </do> </card> </wml>
You can see familiar HTML elements (e.g., the INPUT tags) in this WML document. Notice that within the GO tags, we set the fields for a form and have the data travel to the insertrecruit.asp page to submit the information into the recruiting system. At the beginning of this WML document, a reference points to the Document Type Definition (DTD) that defines the structure of WML. Parsers can easily determine whether you have created a well-formed WML document.
WML is lighter than HTML because you rarely use it to create formatting (you can’t do a whole lot on a cell phone’s display). Because it’s lighter and better formed, you can automatically generate WML files more easily than you can HTML documents. For example, if you’re using SQL Server 2000’s XML capabilities, you can build WML documents dynamically right from the database and serve them to WAP-enabled devices. You can generate forms directly out of SQL in WML format for users to enter information into SQL. In addition, you can transform data into WML format for viewing on WAP-enabled devices.
Don’t have a WAP-enabled device? WAP emulators are available that can run within your browser (for an example, go to the TagTag Web site). For information about setting up Microsoft IIS so that it serves WML files correctly, check out "Wireless Applications on IIS" in IIS Administrator, a monthly print newsletter from the same folks who bring you SQL Server Magazine and Windows 2000 Magazine.