|
Comments
|
Today's Top SOA Links
BF on CF No Strings Attached
No Strings Attached
By: Ben Forta
Nov. 29, 1999 12:00 AM
But all that is about to change. Wireless computing has finally come of age, and you, as a ColdFusion developer, are poised to take a leading role in wireless application development. Want to take a ride into the not-so-distant future? Read on.
Why Wireless Computing? Yes, wireless is compelling. But there's another side to wireless - a far less compelling side: heavy devices, poor battery life, incompatible systems and carriers, lack of coverage and no standard way to access data. Now, none of these issues is irresolvable. On the contrary, technology has reached a point where every one of these problems could be addressed. But doing so would require standards supported and adopted by all the major players in this space. And that's where the real news is.
Introducing WAP And that is significant. WAP will succeed where others have failed because anyone of any significance is backing it. And with members like AT&T, Cable & Wireless, Ericsson, HP, IBM, Intel, Lucent, Microsoft, Nokia, Oracle, Sprint, Sun and dozens of regional and national phone companies, one thing is for sure - WAP Forum has the clout and resources to make wireless a reality once and for all. So what exactly is WAP? At its simplest, it's a data transport protocol, much like HTTP. Actually, WAP is based on HTTP - you can almost think of it as a form of HTTP optimized for wireless communication. But while HTTP is designed primarily for use by Web browsers in a highly connected environment, WAP is designed for wireless devices in a highly disconnected environment. WAP can run on every major operating system (just like HTTP), and it supports the wireless networks used by almost every major carrier. WAP is designed to provide a fast, efficient and secure base on which to build applications for wireless devices. And not just PDAs. WAP is designed for use on cellular phones, pagers, two-way radios and a whole generation of devices that have yet to debut.
Yet Another Markup Language? HTML is very graphic oriented, and I don't mean just the <IMG> tag. Tables, frames, style sheets - most of what we do in HTML is oriented toward visual representation on a computer monitor. And that makes HTML rather useless on wireless devices. In case you thought otherwise, wireless devices don't have 17-inch monitors attached (thank goodness). Most of them have really small screens, capable of displaying a few lines of text and perhaps really simple icons and graphics. In addition, they don't have the processing power, storage and bandwidth to display typical Web pages. And so WAP leverages a new XML-based markup language - WML, or Wireless Markup Language. WML is a tag-based language, just like HTML. But instead of featuring tags designed to build complex and detailed displays, WML tags are used to build lists, process simple data entry and even reprogram device buttons on a page-by-page basis. WML pages are displayed using special browsers called microbrowsers. These are special combinations of hardware and software designed specifically for use in devices with extremely small form factors. One of the best known microbrowsers is produced by Allaire partner Phone.com (the URL for their home page is at the end of this column). To give you a taste for WML, take a look at the example in Listing 1. Without going into all the details, this code creates a simple list with three choices, each associated with a URL. Users can select one of the options (using arrow keys, phone buttons or some other form of selection) to jump to specific pages. Unlike HTML files, WML files don't equate to pages. A single WML may contain multiple pages called cards. WML files are enclosed within <wml> and </wml> tags, and each file contains one or more cards. Using cards, it's possible to send multiple pages to the device simultaneously so that a connection to the server isn't needed for each page displayed. You'll notice that WML shares many tags and attributes with HTML, but there are important language differences too. The example in Listing 2 creates a simple display showing weather information. The display contains a title followed by a table containing the day's high and low temperature values. As you can see, WML supports paragraphs, tables, italics and even images. To improve application performance, WML supports downloaded images (specified using the <img> tag's src attribute) or local images (the localsrc attribute); the latter are all-purpose images (more like little icons and symbols) stored on the device - and there are lots of them. By using local images, the amount of data transferred over the wireless connection can be greatly reduced. WML even supports client-side scripting using a language called WMLScript. While similar to JavaScript, it too has been optimized for microbrowsers and the kinds of operations you'd want to perform on them.
One thing important to note is that WML syntax is far stricter than that of HTML. You'll notice that every tag needs an end tag (or at least an XML-style end slash). In addition, no tags may be omitted (for example, the
Serving WAP Content
The truth is, WAP content must indeed be served by a WAP server, but you don't need one of your own. WAP was designed so that content could be accessed using standard HTTP requests. This was a deliberate decision by the WAP specification authors, and one that greatly increases the viability of the spec. If we all needed new servers, WAP would never gain acceptance.
You can install a WAP server of your own if you'd like, of course, but typically you'd never want to. Rather, you'd serve up WML via HTTP and let the conversion between HTTP and WAP happen on another server called the WAP Gateway - a special piece of software that acts as a filter and adapter. And you wouldn't need your own WAP Gateway either - these are usually owned and hosted by the network carriers.
What this all means is that serving WAP content is pretty simple. The only thing you have to do is identify the content as being WML, and you can do that with a simple MIME type mapping. If you're serving static WML pages, you can usually make that association in the Web server configuration. The MIME type for WML is:
text/vnd.wap.wml
ColdFusion for Wireless
<CFCONTENT TYPE="text/vnd.wap.wml">
Let's take another look at the weather example in Listing 2, but this time, instead of hard-coding the output, we'll generate it dynamically using ColdFusion (see Listing 3).
If the code looks somewhat familiar, that's because it is. Writing ColdFusion-powered WML is no different from writing ColdFusion powered HTML.
Of course, if you need to write in WML, watch out for case-sensitivity issues and convert your JavaScript to WMLScript. But that's not that complicated a process, and it's about to get even easier.
ColdFusion Studio 4.5 now has built-in support for WML. Not only are the tags listed in the Tag Chooser making learning the language easier, there's also a complete set of Tag Editors and page templates provided too. With ColdFusion Studio 4.5 WML development really is as easy as HTML development.
Conclusion
So take the time to start experimenting with WML, it's easy - and fun. Just think how wonderful it would be to have full access to your systems and data from a wireless device and to be accessible to all who need you, anytime, anywhere. Wonderful. Or not.
Note: If you'd like to start writing and testing WML applications but don't have a WML device, download Phone.com's phone emulator (it comes with their SDK). You can get more info from www.phone.com. Reader Feedback: Page 1 of 1
Subscribe to the World's Most Powerful Newsletters
Subscribe to Our Rss Feeds & Get Your SYS-CON News Live!
|
SYS-CON Featured Whitepapers
Most Read This Week |
|||||||||||||||||||||||||||