Programming Applications with the Wireless Application Protocol: The Complete Developer's Guide

Programming Applications with the Wireless Application Protocol: The Complete Developer's Guide

by Steve Mann, Stephen Mann
     
 
The authoritative programming guide to the WAP standard from the creators of this breakthrough technology.
The Wireless Application Protocol (WAP) is the key force turning mass market wireless phones into Internet companions. These lightweight, inexpensive smart phones are well equipped for high-quality voice communication, modest-bandwidth (9-14 Kbps) data

Overview

The authoritative programming guide to the WAP standard from the creators of this breakthrough technology.
The Wireless Application Protocol (WAP) is the key force turning mass market wireless phones into Internet companions. These lightweight, inexpensive smart phones are well equipped for high-quality voice communication, modest-bandwidth (9-14 Kbps) data communication, seamless Internet connectivity, and access to Internet services via built-in WAP microbrowsers. Written with the creators of WAP, this book/CD-ROM package will guide you through the process of creating software for WAP-enabled cell phones and handheld devices.
Steve Mann presents practical tools, code snippets, and complete applications that will help you best utilize WAP. He introduces you to the Wireless Markup Language (WML) that you'll be able to use to create WAP applications. And you'll learn about the key features of WMLScript, including the lightweight procedural capabilities and function libraries it adds to WML. Mann also:*Takes you step by step through the process of creating a real-world WAP application*Describes techniques for optimizing WAP applications*Shows how to create more sophisticated and interesting applications using graphics*Discusses the issues you'll need *in order to build WAP applications that will work around the world*Explains some of the advanced extensions to WAP*Suggests future directions in which WAP may evolve
The CD-ROM includes:*All the source code from the book*A searchable version of the *unabridged WAP standard*The latest release of Phone.com's WAP Software Developer's Kit, containing the tools and documentation required to build real-worldWAPapplications
Phone.com is a leading provider of WAP software and SDKs to developers, wireless carriers, and phone manufacturers. Phone.com cofounded the WAP Forum in 1997 and chaired the WAP Forum's first Board of Directors. Phone.com's software architects, who contributed to this book, chair WAP's technical specification committees. For more information about Phone.com and the Wireless Application Protocol

Editorial Reviews

From the Publisher
"...is the first book to explain how to develop WAP programs, and should simply and quickly get you WAP-wise" (Internet Works, October 2000)
Internet Works
...is the first book to explain how to develop WAP programs, and should simply and quickly get you WAP-wise.
Booknews
A book/CD-ROM guide to the process of creating software for Wireless Application Protocol (WAP)-enabled cell phones and handheld devices. Presents practical tools, code, and complete applications, and introduces Wireless Markup Language (WML) and WMLScript. The CD-ROM contains source code and a WAP software developers kit. The author is president of a leading provider of technical information for the handheld and mobile computing industries. Annotation c. Book News, Inc., Portland, OR (booknews.com)

Product Details

ISBN-13:
9780471327547
Publisher:
Wiley
Publication date:
12/08/1999
Edition description:
BK&CD ROM
Pages:
256
Product dimensions:
7.64(w) x 9.43(h) x 0.91(d)

Read an Excerpt


Chapter 3: WMLScript

At some point in the WAP design life cycle, it became clear the . a could benefit from a way to include client-side procedural logic for doing simple things ike checking user input and generating messages and dialogs locally. To solve this problem, the WAP Forum added a new component to the WAP application model: WMLScript [WAP]. Derived from ECMAScript [ECMA], which is itself derived from JavaScript [JAVASCRIPT] and Self [SELF], WMLScript is a lightweight scripting language that adds many capabilities to a WAP user agent. The WMLScript designers took all the best and most useful features of the language's ancestors, but removed all the features unnecessary or too complex for a wireless data environment.

The WMLScript execution model is function-oriented. There are no main programs. Instead, you create a set of functions and put the resulting text file on a server for access by WML and WMLScript programs. When a function is called, the WAP gateway automatically converts it into its compiled binary format and sends that optimized data over the wireless link. There are definite advantages to storing the source code on your content server. For instance, the WAP gateway can do inter-version adaptation for you-backward compatibility mapping if the language changes in the future.

To access the functions in a WMLScript compilation unit, you call them from a WML program using a URL, where the path points to the compilation unit and the fragment name is the function name.

The WAP gateway fetches the compilation unit source code, extracts the function FireTorpedo, and compiles it. The WMLScript bytecodes are downloaded to the user agent as part of theresponse and executed by the user agent. When the function is done, the interpreter returns control to the WML card that calls FireTorpedo.

Throughout the remainder of this chapter, we describe WMLScript and the WMLScript standard libraries. Because it is a fairly traditional procedural Ian-; guage like C and Java, and because we assume you already know how to pros gram, we don't include a lot of short examples to demonstrate the language's obvious features. We do, however, include examples to explain some of the more complex features, and one larger example at the end of the chapter.

WML versus WMLScript

From a programmer's perspective, WML and WMLScript are different tools designed for different tasks. WML is a declarative markup language designed to express the characteristics of a user interface. WMLScript is an imperative scripting language designed to embody logic and functional programming constructs.

WML has one single, sequential execution thread that has an ongoing global context. There is no execution stack where parameters, instruction pointers, and local variables axe stacked and unstacked. There is a history stack, but it contains locations--cards and URLs. WMLScript has functions, and you call one function from another. The execution is managed using a stack that contains parameters, the current instruction pointer, local variables, and so on. When you call a function, things get pushed on the stack. When you exit, they get popped and disappear.

All WML variables are global. In contrast, all WMLScript variables are local, lasting only as long as the function they reside in is executing. At compile time, WMLScript keeps track of three name spaces-variables, functions, and pragmas (compilation unit-level information).

WML has no procedural statements (although the event/task model does provide limited procedure-like capabilities). WMLScript has a useful set of traditional procedural language statements-an if... else statement, loops, and so on.

WML is content-focused, with elements for formatting output and entering data. WMLScript is procedure-focused. Other than one library function for letting a user enter a string, and another that lets you refresh the device's display, you cannot directly do any data entry or display manipulation with WMLScript.

WML has limited data handling capabilities. You can set variables, create choice lists, and create data-entry format masks. WMLScript, although a loosely typed language, has several internal data types, libraries for converting between types, strings (which you can use for simple array-like operations), and other more sophisticated data handling features.WML is not extensible, except by revising the WML specification. WMLScript includes features for adding libraries of standardized functions. Currently, the WAP Forum does not provide tools or information for third-party developers to create their own libraries. Regardless, it's much easier to extend a language by adding a library than by overhauling a specification.Even though WML and WMLScript are separate tools for separate tasks, you can use them together. You can call a WMLScript function from a WML deck, passing parameters to the function. In addition, WMLScript has library functions that let you read and write WML variables, create new contexts, and execute tasks from a WMLScript program. You can also queue and tasks for execution after the WMLScript interpreter finishes its current execution thread.WMLScript Basics

Like all programming languages, WMLScript is a sequence of case-sensitive language tokens, words, and literals, separated by white space. Groups of tokens form statements, which are separated by semicolons.

You use identifiers to name variables, functions, and pragmas (compilation unit information). WMLScript uses the same rules for naming identifiers that WML uses for variable names:

  • Identifiers are case sensitive.
  • They can only include alphabetic and numeric characters and the underscore character (" ").
  • They cannot start with a digit.

WMLScript has one additional rule for identifier names: They cannot be the same as a reserved word. Table 3.1 shows a list of the current WMLScript reserved words.

WMLScript tracks three separate name spaces-variables and function parameters, function names, and pragmas. You can use the same identifier in each of the name spaces so that you can, for instance, have a variable, a function, and a formal parameter with the same name...

Meet the Author

STEVE MANN is President of Creative Digital Publishing Inc., www.cdpubs.com, a leading provider of technical information for the handheld and mobile computing industries. He has 25 years of experience in the computer industry and is a frequent contributor to many wireless publications.

Customer Reviews

Average Review:

Write a Review

and post it to your social network

     

Most Helpful Customer Reviews

See all customer reviews >