yourfanat wrote: I am using another tool for Oracle developers - dbForge Studio for Oracle. This IDE has lots of usefull features, among them: oracle designer, code competion and formatter, query builder, debugger, profiler, erxport/import, reports and many others. The latest version supports Oracle 12C. More information here.
Cloud Expo on Google News
Cloud Expo & Virtualization 2009 East
Smarter Business Solutions Through Dynamic Infrastructure
Smarter Insights: How the CIO Becomes a Hero Again
Windows Azure
Why VDI?
Maximizing the Business Value of Virtualization in Enterprise and Cloud Computing Environments
Messaging in the Cloud - Email, SMS and Voice
Freedom OSS
Stairway to the Cloud
Sun's Incubation Platform: Helping Startups Serve the Enterprise
Cloud Computing & Enterprise IT: Cost & Operational Benefits
How and Why is a Flexible IT Infrastructure the Key To the Future?
Click For 2008 West
Event Webcasts
Building WAP Applications Using XML-Based WML and WMLScript
Building WAP Applications Using XML-Based WML and WMLScript

By now, of course, you've heard of WAP, or Wireless Application Protocol. Contrary to what some critics want you to believe, WAP doesn't stand for "Where Are the Phones?" Some analysts even coined the phrase "Wait And Participate." Whether WAP is here to stay is beyond the scope of this article, but with the influx of WAP-enabled devices from leading phone manufacturers, such as Motorola, Ericsson, and Nokia, the WAP market seems eager for a couple of killer applications.

In this article I discuss the Wireless Markup Language used in WAP and show how you can build WAP applications using WML and its scripting counterpart, WMLScript.

Wireless Markup Language

WML is based on XML. What's important here is that different vendors can extend the language by specifying their own Document Type Definitions (DTDs). For example, has extended the standard WML specification, and developers can make use of these extended WML features by using's DTD (we'll look at the DTD in a moment). However, for reasons of compatibility, this isn't a good option unless you have control over the devices being used. You're probably thinking: Why do we need another markup language? Isn't HTML doing a good job for Web browsers? Why don't WAP browsers support HTML? WML is designed with the constraints of small, narrowband devices in mind. What this means is that a WML document (known as a deck) must be relatively small for it to be transmitted quickly from a server to devices that use a low bandwidth medium. Current WAP devices have speeds ranging from 9600 to 14400Kbps. And WML content is designed to be displayed in a small, limited screen size. The processing power and user input on a WAP device are also a major consideration for the design of WML. Hence, if you look at a typical HTML page, you'll realize that it's not very suitable for a device with limited capability.

How WML Documents Are Processed

Figure 1 diagrams how a typical WML document is processed.

Here are the steps:

1. The WML document is stored in the Origin Server, a conventional Web server you're already familiar with. We can either save WML documents in their native format (with the .wml extension), or we can use server-side technologies to generate WML content on the fly to create dynamic WAP applications. Microsoft's Active Server Pages (ASP) and Java Servlets are two popular server-side technologies. I'll show how we can develop dynamic WAP applications using ASP in the last section of this article.

2. The wireless terminal makes a connection over the wireless network to the WAP gateway.

3. The wireless terminal specifies a URL to fetch a WML document. The WAP gateway is connected to the Web using the HTTP protocol and fetches the required WML document from the Origin Server.

4. Once the required WML document is fetched from the Origin Server, the WAP gateway compiles the WML document into WAP binary. If the fetched document doesn't conform to the WML specification, an error occurs.

5. The WAP gateway creates a WAP response containing the WAP binary and sends it to the wireless terminal.

6. The wireless terminal parses the received WAP binary and renders the deck and cards on the wireless terminal.

A Simple WML Document

A WML document or deck contains one or more cards and is similar to a deck of playing cards. A deck is a minimum unit of transfer between the Origin Server and a WAP device. The following code shows the typical structure of a WML document:

2.    WML 1.1//EN"

6.           Hello, Wireless Journal readers!!


* Line 1: The processing instruction (PI) for the WML deck (as mentioned earlier, WML is based on XML).

* Line 2: The DTD for WML, as defined by the WAP Forum; can be extended, as it has been by, to provide additional functionality to WML. To use the extended functionality, you have to use the's DTD for WML.

* Line 3: The start of the element, the root element of a WML deck that must always be present.

* Line 4: The element that defines the start of a card, shown here with two attributes. The ID attribute sets the identifier for the card; the label attribute contains the text to be displayed on the WAP browser. Note that the UP.Simulator (explained later) does not show the label.

* Line 5: The

element that indicates the start of a paragraph.

* Line 6: Actual text displayed on the WAP browser.

* Lines 7-9: The corresponding close tags for the

, , and elements.

Rules of WML (or XML)

Since WML is based on XML, it inherits most of its syntactic constructs from it. I'll summarize the rules of WML in the following few points:

  • Elements must be closed. For example, the start tag must be closed with the  end tag. For empty elements, a "/" follows the end of the tag name, for example,
  • Attribute values must be quoted, for example, . Both single and double quotes are accepted.
  • Tag names are case-sensitive. For example, and are considered different tags.
  • WML text can contain numeric or named character entities. An example is the use of special characters, such as the ampersand, which in this case must be replaced by an entity &.
  • Comments have the following styles: .
  • Variable values are referenced by preceding the variable name with a $ character, for example, $amount.
Testing Your Applications

To test the application in this article, you can use a WAP emulator that runs on your PC before trying it out on a real device. One of my favorite emulators is the UP.Simulator by, which I used in this application. Figure 2a shows the emulator. The UP.Simulator can be downloaded from's Web site
( Figures 2b-2d show other available emulators:

Besides using a WAP emulator, I suggest you set up a Web server for testing purposes. Though the examples in WML and WMLScript can be tested directly from the local hard disk, later examples involving ASP use a Web server. If you're using Windows 95/98, you can use the Microsoft Personal Web Server (PWS). PWS comes with the Windows 98 installation CD or it can be downloaded from the Microsoft Web site under the name NT Option Pack. For the examples in this article I used the MS Internet Information Server (IIS) 4.0 running under Windows NT Server 4.0.

Setting the MIME Type

Before you try out the examples, set the following MIME types on your system:

  • .WML - text/vnd.wap.wml
  • .WMLS - text/vnd.wap.wmlscript
  • .WBMP - image/vnd.wap.wbmp
These MIME types simply indicate to the emulator (or devices) that the content it's receiving is WML, WMLScript, and WBMP, respectively.

Setting New MIME Types

To set a new MIME type under IIS 4.0:

1. Select the Web site, right-click on it, and select Properties.
2. Select the HTTP Header tab and under the MIME Map section click on File Types.
3. Click on New Type to add the two new MIME types.

To set a new MIME type under PWS:

1. Double-click on My Computer.
2. Click on the View-> Folder Options menu item.
3. Click on the File Types tab.
4. Add the two new MIME types (see Figure 3).

Text and Image Presentation in WML

If you've been faithfully following the steps mentioned in the previous sections, you're ready to test the example application! Save the Hello.wml deck onto your Web publishing directory. For example, your homepage directory may be mapped to c:\inetpub\wwwroot.

Once the deck is saved, key in the following at the Go address box: http://localhost/hello.wml

You should see the screen in Figure 4. Let's add a little
flavor to our example:


           Hello, Wireless Journal readers!!

Figure 5 shows the output changes.

What about images?

WAP supports a special kind of graphics format known as the WBMP (wireless bitmap). Converters are available either as a stand-alone application or as a plug-in for your favorite graphics editor such Adobe PhotoShop. Figure 6 shows an image in the BMP format and another in WBMP format. The original picture was saved in the BMP format and is 39KB. After the conversion, it's 2KB (see Figure 7). Notice the huge loss of image quality due to the desire to reduce the size of the image for transmission over the narrow band. You can download a converter from the following Web site, To display an image in a card (see Figure 8), use the element:






The element in this code contains two attributes: src
and alt. The former specifies the image name, the latter the text to
be displayed in the event the device isn't able to support graphics.
Other attributes of the element are localsrc, align, height,
width, vspace, and hspace. An interesting feature of the
element is its ability to load a prestored icon on the WAP device.






The localsrc attribute specifies the name of the icon stored on the device. Note that the src attribute is still required (even though we left it blank). If the device can't locate the icon specified by the localsrc attribute, the picture specified by the src attribute will be used instead. For a list of prestored icons please refer to the documentation provided by the device. Note: The icons displayed are dependent on the device.

Cards and Decks Navigation

I mentioned that a WML deck could contain one or more cards. Listing 1 provides an example. In Listing 1 we have two cards in a deck that we link up using the and elements. The former maps a function to a softkey on the handset; the latter specifies the URL to link to (in this case, the card to go to).


When you click on the softkey mapped to the XML task (see line 7), card2 will be displayed (see line 8). The element can be used to map to other decks and cards as well. For example:

links to card2 in a deck called anotherdeck.wml. If a deck name isn't specified, like the following:

card2 is assumed to be in the current deck. If a card name isn't specified, the first card in the destination deck is assumed:

In this case the first deck in anotherdeck.wml would be loaded.

User Inputs

Besides displaying texts and pictures, the WAP browser takes in user input. This is useful when the user can supply information to be sent to the Origin Server for processing (see Listing 2). The element is similar to the one found in HTML. If the type attribute were set to "password," the data keyed in would be replaced with asterisks (see lines 7-8). The element in WML allows you to limit the kind of characters the user can input. For example:

UserID :

The maxlength attribute indicates you can enter up to eight characters for UserID. The format attribute indicates that, at most, only two numeric values are accepted.


The previous example shows the element in action. In the element:

UserID :

userID is known as the WML variable. To reference a WML variable, simply prefix the WML variable with a "$" character:


       Your UserId is $userID

In WML, variables have global scope, that is, the variable userID can be accessed from any deck.

Size Limitations

I mentioned that a WML deck could contain one or more cards. How many can it contain? Remember, a WML deck is compiled to its bytecode equivalent (WAP binary). The bytecode is then sent to the WAP device. WAP devices have limited memory to store the bytecode, which indirectly puts a constraint on the size of the deck. Table 1 shows the limits of some common WAP phones. In general, avoid putting too many cards in a deck as this may cause the size of the bytecode to be huge and more likely to exceed the limits of a WAP device. Also, a large deck will result in a longer download time, which is definitely not desirable.

Client-Side Scripting Using WMLScript

By now I'm sure you'll have a better idea of how WML is used. You may realize that the WML deck content is pretty static. After all, you're accustomed to interactive Web pages that contain animations and sounds. You'd sort of expect the same on a WAP device. Well, we're not really there yet. At the moment, WAP has a scripting language, WMLScript, that's similar to what you have on the Web: JavaScript and VBScript. WMLScript is based on the ECMAScript and as such shares a syntax similar to that of JavaScript. I'll leave it to sources on the Web to describe the syntax of the language. (See the list at the end of this article.)

Here are some examples to give you an idea of the structure of the language and what you can do with it. Let's consider the sample application discussed earlier. We asked the user to key in the user ID and to key in the password twice. A typical application would be registering new users for your service and allowing them to use a password they've chosen. There's no way for WML to validate that the two passwords are similar before we can allow the registration to proceed. In this case we can use WMLScript to perform the validation on the device's end (see Listing 3).

In Line 9 of Listing 3 I've added a element for the user to press once the second password has been entered. Instead of linking to another WML deck, I've linked it to a WMLScript document (validate.wmls). Following the WMLScript document, I specify the name of the function to be called (verifyPassword()) and pass in the two passwords that have been entered. Listing 4 provides the validate.wmls WMLScript document. The WMLScript document contains two functions, verifyPassword() and DisplayMessage(). The first function contains two input parameters (Password1 and Password2); the second contains a single input parameter (message). Note that the first function has the keyword "extern" preceding it. Only functions declared with the extern keyword are accessible by a WML deck. For example, the following is invalid:

because the function DisplayMessage() hasn't been declared with the extern keyword.

Coming back to the VerifyPassword() function, I first declare a variable in WMLScript using the var reserved word in Line 3 of Listing 4. In Line 4 I use the Compare() function from the String library to compare the two passwords. WMLScript supports extended functionality through the use of libraries. Table 2 shows the available libraries. In addition, various vendors, such as and Nokia, support their own proprietary (nonstandard) libraries to extend the functionality of WMLScript. To use a library function, specify the Library name followed by a dot (.), the function name, and its input parameters.

Once the two passwords are found to be the same, I form the URL (for registration). I then use the go() function (Line 6) from the WMLBrowser library to load up the new deck (register.asp). (Using ASP scripting to generate a dynamic WAP application is discussed in the last section of this article.) If the two passwords don't match, the DisplayMessage() function is called (Line 9). As you can see, this function uses the alert() function from the Dialog library to display a message on the WAP browser. When the user clicks OK, the Register.wml deck is loaded again (Line 10).

Before we complete the example on WMLScript I'll provide another one. I'm a strong believer in learning by example, and in Listing 5 we have a simple WMLScript program that calculates the factorial of a number. For a more detailed description of WML and WMLScript, point your Web browser to the technical specification located at, Ericsson, and Nokia also provide excellent tutorials on this language. Their documentation can be downloaded from their respective Web sites.

Dynamic WAP Content Using ASP

I'm now going to demonstrate how to use a server-side technology to develop a dynamic WAP application using ASP. So far, all the processing has been done on the client side using WML and WMLScript.

Remember the earlier example, where we ask the user to key in a userID and password? When the WMLScript program confirmed that the two passwords were the same, I used the WMLBrowser.go() function to link to the ASP document (register.asp). I also provided a query string that contained the userID and password of the user:

    URL = "register.asp?userID=" + WMLBrowser.getVar("userID") +
"&password=" + Password1;

If the userID is "lwm" and the password is "secret," the query string would be:


The following ASP document located on the Web server would perform the registration (see Listing 6).

Line 1 of Listing 6 sets the MIME type for the document. The Web server processes this ASP document and returns a WML deck to the client. Hence it's necessary to set the MIME type using the

Response.ContentType property.

Lines 7-16 are where all the processing is done. I presume you're familiar with ASP and database access using Microsoft ActiveX Data Objects (ADO).

When the new user is registered, you'll see the screen in Figure 9.

What's Next?

If you're planning on developing WAP applications, you should be conversant with these languages:

  • WML
  • WMLScript
  • A server-side technology such as ASP or Java Servlets
Much of the WAP applications you're likely to develop are time sensitive. Examples of such applications are stock quotes, weather information, and reservation systems. In such cases the ability to perform server-side processing is important, if not mandatory.

For a good reference to WAP application development, I recommend the book Professional WAP, published by Wrox Press.

This has been kind of a whirlwind tour of WAP, and I've teased you with examples coded in WML and WMLScript. I hope you now have a better understanding of the technology and are ready to develop your first WAP application for your company. I'd be interested in how you use the technology; you can contact me via my e-mail address. In my next article I'll talk about troubleshooting WAP applications. Because of a lack of development tools, debugging skills are an important asset to both you and your organization.


1. WAP Specifications
2. UP.Simulator
3. Nokia WAP Toolkit
4. Ericsson WAP IDE
5. WBMP Converter

About Wei Meng Lee
Wei Meng is an author and developer specializing in XML and Web technologies. He is the co-author of XML Programming using the Microsoft XML Parser (Apress) and the series editor for Syngress' .NET Developer Series

In order to post a comment you need to be registered and logged in.

Register | Sign-in

Reader Feedback: Page 1 of 1

Latest Cloud Developer Stories
DevOpsSummit New York 2018, colocated with CloudEXPO | DXWorldEXPO New York 2018 will be held November 11-13, 2018, in New York City. Digital Transformation (DX) is a major focus with the introduction of DXWorldEXPO within the program. Successful transformation requires a lase...
With 10 simultaneous tracks, keynotes, general sessions and targeted breakout classes, @CloudEXPO and DXWorldEXPO are two of the most important technology events of the year. Since its launch over eight years ago, @CloudEXPO and DXWorldEXPO have presented a rock star faculty as w...
Cloud Expo | DXWorld Expo have announced the conference tracks for Cloud Expo 2018. Cloud Expo will be held June 5-7, 2018, at the Javits Center in New York City, and November 6-8, 2018, at the Santa Clara Convention Center, Santa Clara, CA. Digital Transformation (DX) is a major...
DXWordEXPO New York 2018, colocated with CloudEXPO New York 2018 will be held November 11-13, 2018, in New York City and will bring together Cloud Computing, FinTech and Blockchain, Digital Transformation, Big Data, Internet of Things, DevOps, AI, Machine Learning and WebRTC to ...
@DevOpsSummit New York 2018, colocated with CloudEXPO | DXWorldEXPO New York 2018 will be held November 11-13, 2018, in New York City. From showcase success stories from early adopters and web-scale businesses, DevOps is expanding to organizations of all sizes, including the worl...
Subscribe to the World's Most Powerful Newsletters
Subscribe to Our Rss Feeds & Get Your SYS-CON News Live!
Click to Add our RSS Feeds to the Service of Your Choice:
Google Reader or Homepage Add to My Yahoo! Subscribe with Bloglines Subscribe in NewsGator Online
myFeedster Add to My AOL Subscribe in Rojo Add 'Hugg' to Newsburst from CNET Kinja Digest View Additional SYS-CON Feeds
Publish Your Article! Please send it to editorial(at)!

Advertise on this site! Contact advertising(at)! 201 802-3021

SYS-CON Featured Whitepapers