Dynamic Wireless Applications, Part 2

The infrastructure and development tools used to develop dynamic wireless applications with ASP parallel those used in Web development. This article shows how.

Dynamic wireless application development using server-page technology such as Active Server Pages (ASP) is currently the preferred way to deliver dynamic Wireless Application Protocol (WAP) applications.

Experienced Web developers who take on wireless applications will find that their existing skills transfer well to the new challenge, but they must learn Wireless Markup Language (WML) and the differing form factors of WAP devices. The infrastructure and development tools used to develop dynamic wireless applications with ASP parallel those used in Web development. Many developers use Microsoft's VisualInterDev, Allaire's Homesite, or any IDE as development environments. During application development, a text editor helps balance the WML's simple syntax and mediocre visual tools.

Server-page technology involves embedding the scripting language within the markup language. When the WAP device requests the dynamic WAP application URL, the Web server processes all the ASP script and delivers only the customized WML deck and cards to the wireless device.

The sample code shows a VBScript/WML combination used to check product stock levels in a wireless sales automation scenario. The code is given in simplified form here; the actual code will typically contain files, COM objects, functions, error handling, procedure calls and other advanced development features. For example, an error-handling code will prevent the WML deck from exceeding 1.5Kb, as could occur if too many product records were returned from the database query.

Response.ContentType = "text/vnd.wap.wml"

Dim dbConn, rsProducts, sql 

Set dbConn = CreateObject("ADODB.Connection") 
dbConn.Open "Driver=\{SQL 

sql="SELECT ProductName, ProductQuantity FROM Products" 
Set rsProducts = dbconn.Execute(sql) 

<?xml version="1.0"?> 
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "<http://www.wapforum.org/DTD/wml_1.1.xml>"> 
<card id="Home" title="StockLevel"> 
        <p align="center"> 
        <b>--Stock Level--</b> 
        <p align="left"> 
        Do while not rsProducts.EOF 
        Response.Write "<p>-" & rsProducts("ProductName") & 

        ":" & rsProducts("ProductQuantity") & "</p>" 
        Set rsProducts = Nothing 
        Set dbConn = Nothing 

The WML deck and embedded VBScript lie within this ASP page, which shows a SQL Server connection, an embedded SQL statement, and a resulting recordset with products and the quantities. Within the StockLevel card, the loop goes through recordset and displays the product name and quantity. Note the Response.ContentType property set to the WAP MIME type.

This example demonstrates a simple product-list display. To develop the example into an application, use another deck to display product-category options to show in the first deck. The user could select a product category, which could be passed to the second deck by HTTP POST or GET commands. By using the request object, the variable could be captured and used in the SQL statement, resulting in the display of that category's products. These techniques apply to developing almost any type of application.

From the user's point of view, data entry on a WAP-enabled device works best by displaying a list of menu choices that lead to the next step. When users must tap repeatedly on the device's keypad to enter data, errors ensue.

Finally, WAP applications function in real time and thus require a constant wireless Internet connection during use. In the future, we'll explore synchronization solutions that provide offline access to application resources.

The next Wireless & Mobile UPDATE will discuss additional techniques and give some tips and tricks for developing dynamic wireless applications with ASP.

Hide comments


  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.