Creating a WML phone directory

 

Summary

Create a phone directory you can access from mobile devices using the wireless markup language (WML).

Events

IBM Technology Conference & Expo 2012
May 23, 2012

Convention Centre B2 Room at 22nd Floor, Centara Grand @ Central World, 999/99 Rama I Road, Pathumwan, Bangkok 10330

Echelon 2012
June 11 and 12, 2012

University Cultural Centre, National University of Singapore

Startup Asia Jakarta 2012
June 7 and 8, 2012

12th Floor, Annex Building, Wisma Nusantara Complex, Jl. M.H. Thamrin No. 59 Jakarta 10350, Indonesia

MMA Forum Singapore
April 23-25, 2012

Grand Hyatt Singapore

Mobile devices are the way of the future for information sharing. A drawback is that mobile devices don't quite have the power of a standard desktop computer. This prevents you from developing feature-rich sites that are easily navigable through the use of images and JavaScript. However, with Wireless Markup Language (WML) and careful planning, you can create a nice wireless solution.

One solution you can develop is a company directory. Let's say that you've already provided your company with an internal directory, and now you want to open that directory up to other possible users (e.g., vendors, suppliers, etc.). Before doing so, you should understand how WML works.

How WML works
WML is based on a deck-of-cards concept, in which you control how many cards are within a deck. When a mobile device makes a request to the WAP server, it requests a deck rather than a page. This deck is loaded in the mobile device, and the user can navigate between cards without requiring another request to the server.

WML is similar to HTML, except WML is based on the XML 1.0 standard, so tags are case-sensitive and all tags require closing tags. WML is also stricter than HTML with a smaller set of tags available. Also, the user of tables and images is restricted.

Creating a solution
First, figure out what functionality you want to provide your users. Be sure to keep in mind how much information is necessary to make your wireless solution navigable without incurring too much traffic; also, remember that your users have to pay for airtime.

In my case, I want the user to be able to look up employee information based on last name, first name, location, or department. For first name or last name, it only requires the user input the first or last name of the person for whom they're searching. However, for location or department, the user will get a list of options.

WML files based on the WML 1.1 standard begin with the following:

<?xml version="1.0"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN"
"http://www.wapforum.org/DTD/wml_1.1.xml">


This specifies that it's an XML document and a WML doctype. A deck is composed of the following:

. . .
<wml>
<card/>
</wml>


Let's start with our first deck:

. . .
<wml>
<card id="main" title="Directory" newcontext="true">
<p>
Search By...<br/>
<anchor>Last Name
<go href="#ln"/>
</anchor><br/>
<anchor>First Name
<go href="#fn"/>
</anchor><br/>
<anchor>Location
<go href="search.asp" method="post">
<postfield name="qt" value="loc"/>
<postfield name="qv" value=""/>
</go>
</anchor><br/>
<anchor>Department
<go href="search.asp" method="post">
<postfield name="qt" value="dpt"/>
<postfield name="qv" value=""/>
</go>
</anchor><br/>
</p>
</card>

<card id="ln" title="Last Name">
<p>
Enter Last Name:<br/>
<input name="qv"/>
</p>
<p>
<anchor>Submit
<go href="search.asp" method="post">
<postfield name="qt" value="ln"/>
<postfield name="qv" value="$qv"/>
</go>
</anchor>
</p>
</card>

<card id="fn" title="First Name">
<p>
Enter First Name:<br/>
<input name="qv"/>
</p>
<p>
<anchor>Submit
<go href="search.asp" method="post">
<postfield name="qt" value="fn"/>
<postfield name="qv" value="$qv"/>
</go>
</anchor>
</p>
</card>

</wml>

What this code creates
When the first card displays on the phone, it shows a list of search options. Each of these options is an <anchor> with an associated <go> tag. The <go> tags tell the microbrowser where to go. Any href beginning with # refers to another card within the current deck; otherwise, it refers to another WML file.

When you click on First Name or Last Name, the microbrowser navigates to the associated cards in the deck. However, if you click on Location or Department, the microbrowser will request the WML located at "search.asp". This is necessary because we're going to provide the user with a list of either locations or departments from which to select as search criteria. The reason for separating this is because the phone's resources are limited, and there's no reason to inundate the phone with data that may or may not be used. If the user selects Location or Department, we can supply that data at that time.

The Last Name and First Name cards contain an <input> element and another <anchor> to submit the search data to the server. If you notice in the <go> element on the Last Name and First Name cards, there are a couple of <postfield> elements that are used to send data to the server. The <input> elements in WML are used to set global variables with the same names as the <input> name attribute. This is a big difference from the way normal HTML pages work. When you want to submit this data to the server, you create <postfield> elements and set their values using WML variables. You'll notice the value of the "qv" <postfield> element is set to "$qv". You refer to the variables in this manner.

Once you have the necessary data, you pass that data through the <go> element back to the server. It's a good practice to use the method attribute of the <go> element to submit data as post data.

Next, I'll collect the data and provide a return WML page to provide the locations and departments and to provide a list of results from the search criteria. Clicking on an element in the results list will return full information for that particular directory entry.The ASP page takes the form input from the mobile device and uses that information to provide a list of results from the search. However, for the location and department searches, a list of locations and departments are provided if one hasn't already been selected.

I'm using a Microsoft Access database as the underlying data. Here's the code to take the search criteria and create the output necessary:

First, this page sets the Content-type of the response to "text/vnd.wap.wml", which is the MIME-type that mobile devices (and WAP gateways) understand. Then, I open a connection to the database through ADO. I create a couple of local variables to hold my query type (qt) and query value (qv) form values. Then, I write out the top portion of the WML page to the Response buffer.

In the next bunch of VBScript, I check the query type for the appropriate action. If the query type is "loc" for location, I check the query value variable to see if it's set. If the query type isn't "loc", I return a list from which the user will select a location. Then I do the same thing for "dpt" or department.

When the user enters the query type and query value, I create a list of anchors from the names in the data; this is also true for last name and first name search. Because of the limitations of WAP and WML, I restrict my output to five names. If there are more than five names in the result set, I pass another anchor that says "More. . .". This anchor also provides the last identity column from the underlying data. This information is used to supply the next group of results from the query.

When the user selects the name anchor, they're sent to the final page that displays the information on the selected name. Here's the code that accomplishes this:

This code looks into the underlying data to find the person that matches the identity column data (tblPhone.phone_id). The result is a line that displays the person's name, a line for the phone number, a line for the department, and a line for the location. I also provide the phone number in an <input> element, so when the user focuses on this field, the user's phone may give them the option to use that number.

When you provide your output as the result of a scripting language such as ASP, you need to set the Content-type on the result; this lets the WAP gateway know that it's dealing with WML data. Also, keep your information to a minimum, since phones' resources may be limited.

In order to create this code and test it without incurring severe cell phone charges, I used the downloadable Nokia Mobile Internet Toolkit (which is listed under the Content Authoring heading).

Phillip Perkins is a contractor with Ajilon Consulting. His experience ranges from machine control and client server to corporate intranet applications.

Talkback

Add your opinion

In order to post a comment, you need to be registered. (Sign In or register below)

Post your comment

ZDNet Asia Live

Big data acquisitions pave way to fast, effective innovation - ZDNet Asia News http://t.co/vDZpl0lu

"Big data acquisitions pave way to fast, effective innovation" including @Vivisimo_Inc (client) in @ZDnetAsia http://t.co/yNSdPqbb

Homegrown smartphone OSes gaining favor in China: 59 Jakarta 10350, Indonesia Locally-made mobile operating syst... http://t.co/BruP98Es

RT @MDMGeek: Big data acquisitions pave way to fast, effective innovation - ZDNet Asia http://t.co/ky8YgPAn #Bigdata #analytics via @ciropuglisi

Integration, focused investments to propel Windows Phone http://t.co/6JkDa9sB

RT @AsianFashionLaw: Malaysia offers some manufacturing benefits over China http://t.co/bMquIFiX

Acquisitions in the Big Data market increasingly important to enterprises… http://t.co/Br4BkXyZ

Experience trumps content in apps monetization http://t.co/iaCY5ebX

Malaysia offers some manufacturing benefits over China http://t.co/bMquIFiX

RT @MDMGeek: Big data acquisitions pave way to fast, effective innovation - ZDNet Asia http://t.co/ky8YgPAn #Bigdata #analytics via @ciropuglisi

Thats it.Im digging up an old bus plan i wrote around acquisition of #bigdata talent. http://t.co/gpkha5A1 Any investors want2 read/discuss?

Integration, focused investments to propel Windows Phone: By Kevin Kwang , ZDNet Asia on May 23, 2012 (2 mins ag... http://t.co/aaa0Cb73

Homegrown smartphone OSes gaining favor in China http://t.co/lOBVp1T6

Homegrown smartphone OSes gaining favor in China: 59 Jakarta 10350, Indonesia Locally-made mobile operating syst... http://t.co/gHypbdIY

Integration, focused investments to propel Windows Phone - ZDNet Asia http://t.co/7sZi6Dhb

So much as we know , MTK6575 extremely integrated frequency1GHz ARM Cortex-A9 processor, the superiority of 3G / HSPA Modem, and help the...

1 day ago by y15822137359 on 5 SaaS adoption speed bumps to avoid

I reckon your view: "CRM is strategy, not software", if a company replicating the approach uses in ERP implementation into CRM, what they...

2 days ago by wykoong on Gartner: Mobile CRM gives better ROI than social

This video will teach you about the Excel fill handle but also provide you with a workook to download... http://www.youtube.com/watch?v=...

3 days ago by TradeBrother on A quick fill handle trick for Microsoft Excel

waiting...

5 days ago by eapete on What should count in a company's market value?

Boy, you've opened a can of worms now.

Wait for the rants & raves.

5 days ago by eapete on What should count in a company's market value?

I was puzzling before this whether to replicate the success formula we executed for a financial institute, and come out with a standard s...

5 days ago by wykoong on Drop the egos, copy ideas, then innovate