|By Paul Elisii||
|April 3, 2000 12:00 AM EDT||
I am completely hooked on my new wireless Palm! The Palm Pilot VII has changed the way I access information I can find it anywhere and any time I need it. With the newest Palm I can check account balances in real time on DLJDirect, buy a book from Amazon.com and using the popular Starbucks Finder application find the nearest Starbucks. With so many useful wireless applications available, you might be wondering why you can't create your own with ColdFusion. Well, you can! And after reading this article, you'll be well on the way to writing your own wireless applications for the Palm Pilot VII.
Wireless Applications Background
I'm not the only one who's in love with the idea of wireless access to the Web. In a recent study it was reported that the market for wireless handheld devices could reach 500 million by 2003, which will create a huge demand for Web applications that are "unplugged" and optimized for wireless devices.
For developing wireless applications, two similar but competing protocols for wireless Web access have emerged. The first is the Palm Wireless Web Clipping Protocol a proprietary but popular solution developed by 3COM. The second is the Wireless Application Protocol. WAP is a more open protocol developed by companies like Unwired Planet, Motorola, Nokia and Ericsson to provide wireless Web access to cellular phones. For this article I'll focus on writing wireless Web applications in ColdFusion for the Palm Pilot Web clipping protocol, and in a future article I'll discuss how to write ColdFusion applications for WAP. Even though these two protocols are different in their implementations, developing applications for each is quite similar.
The palm.net Service
The Palm Pilot VII is a wireless device that contains its own built-in antennae for wireless access to the Web. Once you bring your Palm home, it's easy to sign on and start surfing wirelessly on the Web simply flip up your Palm's antennae and access the Activate Application to sign on. All it takes is a credit card and about 15 minutes to get started.
3COM charges an online access fee to access the palm.net service. This is a monthly service fee similar to what you'd pay an ISP for Internet access. The palm.net service is a bit pricey compared to your basic ISP costs, and also comes with limits on the number of bytes that can be accessed on a monthly basis. 3COM has basic, extended and volume plans that range from $10 per month to $40 per month, with each providing a greater number of KB per month. I purchased the volume plan and, in the first several weeks with fairly active use, I haven't used up even half of my quota.
3COM provides a Web site, www.palm.net, with a lot of great information about the service and a wide array of Web clipping applications that you can download. Available applications include Financial, News, Reference, Travel, Entertainment, Communication, Shopping and Enterprise applications. It also includes a Web browsing function that allows you to access any URL, many stock quote and online trading systems, an application to check airline flight times, and various shopping apps, including Amazon.
Web Clipping Architecture
At the heart of the palm.net service is 3COM's Web clipping proxy server. This server is responsible for converting the standard Internet protocols and content from normal HTML Web pages into a form that's optimized for low-bandwidth wireless transmission and for display on a small device. Figure 1 shows how the proxy server takes the HTTP, SSL and TCP standard protocols and compresses them for wireless access via the Palm Pilot VII.
ColdFusion applications work in this environment just like any other Web page. URL requests are made from the Palm. They go through the wireless network and the proxy to the ultimate destination of the Web server. It doesn't matter that the requested page is an HTML, a CFM or an ASP. As long as the actual content returned from the server is in HTML format that can be processed, compressed and sent through the wireless network, it should work just fine.
Does this mean you can just take your existing ColdFusion apps and make them accessible to the wireless network and they'll work? Well, not quite. As I'll explain in the following section, there are many considerations you have to keep in mind when developing unplugged (wireless) ColdFusion Applications.
The following steps demonstrate the flow of a Web clipping application when launched:
- 1. If the linked page or graphic is installed on the Palm VII organizer, the page or graphic is displayed without downloading anything remotely.
2. In other cases the Palm VII organizer compresses the query into a small file in Palm query format and sends this packet over the air to a local base station.
3. The local base station relays the compressed packet to the Web clipping proxy servers on the palm.net service.
4. The Web clipping proxy server translates the query packet into a standard HTTP packet and then sends the decompressed query to the appropriate Internet address. All communication between the Web clipping proxy server and the Internet server is via the standard Internet protocols of TCP, HTTP and SSL.
5. The HTTP server returns an HTML clipping to the Web clipping proxy server.
6. The Web clipping proxy server compresses the HTML clipping into a Palm proxy format file and sends it back to the local base station.
7. The local base station relays the clipping to the Palm VII organizer, where the Web clipping application renders the page for viewing. Communication between the Palm VII organizer and the Web clipping proxy server is via the User Datagram Protocol (UDP).
The basic mechanics of authoring Web clipping applications are similar to the mechanics of authoring Web pages in general. However, because of the constraints of authoring for a handheld organizer connected to the Internet via a relatively expensive radio link, you'll need to rethink your philosophy of design and implementation. The world looks much different when you're holding a small, low-power computer like the Palm VII organizer with its tiny screen, battery-powered operation and relatively slow and expensive wireless connection to the Internet.
Palm applications are called PQAs (Palm query applications). A Web clipping application is a PQA that is developed to take advantage of the wireless capability of the Palm VII.
The basic steps involved in writing a PQA application include the following:
When developing Web clipping applications, follow the same rules as above. What makes a PQA a Web clipping application is that it has links to pages that are not stored on the Palm but are accessed remotely over the Web. These remote links are coded just like any other Web application link.
Writing a Simple Web Clipping App
The following example shows how you can create the most basic Web clipping application for the Palm Pilot. It's very simple. You can start out with the code in a single HTML file that does nothing more than display "Hello World." The entire HTML source code that's used to build the application is in Listing 1.
The first step in turning the HTML file into a Web clipping app is to create a PQA file through 3COM's Query Application Builder, which can be found at www.palm.com/devzone. (Note that the domain for this is palm.com, not palm.net.)
The Query Application Builder is a simple application that converts your HTML and image files into a single PQA file. Just select the File and Open Index menu to select your HTML file.
Once an HTML file is selected, it's displayed in the Query Application Builder file window. If the HTML file referenced any local images, they'd be displayed here, as well as included in the PQA file (see Figure 2).
Once the HTML file has been selected, choose "Build PQA" from the File menu. Then the Build PQA Dialog Box specifies the name of the PQA that is being created (see Figure 3).
Note: The icons for this application default to the diamonds with the remote signal displayed on the right in Figure 3. For this application the defaults are being used. In the next example, using ColdFusion, an Allaire image is used for the application icon.
Now that you've created the "Hello World" Web clipping application, you can install it to your Palm VII handheld using the Palm desktop software. This is the same process you'd go through to install any PQA application onto your Palm. Just add applications to the desktop software running on your workstation and then load the application to your Palm by synchronizing Palm's HotSync utility.
Once you add and synchronize the new PQA, you'll see the new application appear on your Palm. Now we have a new application icon on our Palm called "Hello World" (see Figure 4).Clicking on the new "Hello World" application icon will launch our simple application. Figure 5 shows our simple application running on the Palm. Remember that so far we've only accessed local data. Next we'll get into accessing data over the Web.
Writing a ColdFusion Web Clipping App
In order to write a ColdFusion application for the Palm, we have to involve more than just local pages. As in the previous example, we must add Web clipping pages remotely over the Web.
The two main components in a Web clipping application are as follows:
- Web clipping application (also known as the PQA): This is an application you build using HTML, which is installed by the end user onto a handheld organizer. A Web clipping application is like a mini-Web site that's stored locally, so access to it is instant and free. The index page of the Web clipping application usually contains either a form or a list of links, which are the gateways to the live data provided by your server.
The part of the application that gets compiled into the PQA must be generic and should include only what's not likely to change. If anything changes in the code that's compiled into the PQA, the application has to be redistributed and reloaded onto the Palm Pilots of all your users.
- Results pages (clippings): Pages are returned by your back-end server after receiving a request from your Web clipping application. It's the key part of the overall application, and where all the real work gets done. These pages can be written in HTML, ColdFusion, ASP or whatever. The pages can pull in remote database information and behave similarly to browser-based ColdFusion pages. Images can either be referenced remotely or locally if they were pulled into the PQA. Referring to local images is very useful in saving precious bandwidth, but it leaves less room later to change those images without redistributing the PQA.
The Web clipping pages developed as part of the application can also be accessed through a browser in addition to being accessible through the Palm. Does this mean you can develop an application and deploy it to both the browser and Palm? Not really. Since the Palm only supports a subset of things that can be done on a browser, the UI needs to be specific to the Palm.
One strategy in deploying applications to both the Palm and browser is to separate the user interface from the business and database logic as much as possible so that business logic pages can be included in both the Palm and browser versions of the application. In many ways you can just treat the Palm as a very, very limited browser. The limited nature of this handheld device is equally true with the WAP applications. Web Clipping HTML Specifics
Web clipping applications are designed to be small and to give users the information they need with minimum effort and maximum speed. Likewise, results coming from your server to a handheld device are designed to be small and to the point. Remember, this is not Web browsing, but Web clipping. Web clipping applications should be written to provide users only with the information they need, without any extraneous items. Try limiting the size of your result pages to about 400 bytes.
There are two meta tags you'll want to consider incorporating into your Web clipping applications:
<meta name="PalmComputingPlatform" content="true">
<meta name="LocalIcon" content="images/palm_image.gif">
Two other meta tags are also useful.
<meta name="HistoryListText" content="true">
<meta name="PalmLauncherRevision" content="1.0">
Web clipping applications also support secure HTTPS connections to make credit card purchases and stock transactions possible. The Palm indicates a link is an over-the-air secure link by automatically displaying the top icon at right on all anchor tags, except where a user-defined image is used. All other over-the-air links have the bottom icon at right next to the link. To ensure consistency with other Palm applications, user-defined images should include either the secure icon or the nonsecure icon.
In Web clipping applications there are three types of links that you'll be using. The first is a link from one local page to another on the Palm a remote link to a remote link. The syntax for this link is the following:
The second type of link is from a local page to a remote page. The syntax for this link is the following:
The third type of link is from a remote page to a local page stored on the Palm. The syntax for this link is the following:
Since the Palm screen is much smaller than a browser page, graphics should be used with care. GIF and JPEG images are both supported by the Web clipping system. However, the usable screen size is only 153 pixels wide by 144 pixels high and only gray-scale images are supported.
The idea in developing Web clipping applications is to keep the images small and to reference them locally wherever possible.
The LocalIcon meta tag is used to store graphics locally, using the following syntax:
<meta name="LocalIcon" content="images/palm_image.gif">
It can be referred to remotely in a clipping page using the following syntax:
<td><IMG height=30 src="coldfusion.pqa/palm_image.gif" width=30></td>
Sample ColdFusion Application
The following application shows how a ColdFusion application interacts with a PQA. The application is a simple ColdFusion application that contains a form that accepts a keyword and then passes it to a result page that queries a database of contacts and returns the results.
Figure 6 shows the ColdFusion sample application that was created using the Query Application Builder and loaded onto the Palm. It is called ColdFusion.
Listing 2 shows the code associated with the HTML file used to build the PQA. This form loads a local image to be displayed on the page and contains a link to my ColdFusion page (the Web clipping).
This sample page makes use of a table that contains some text and a local image reference. In addition, it contains the link that references the remote clipping page developed in ColdFusion. The page on the Palm looks like Figure 7.
Listing 3 shows the source code of the simple ColdFusion page that is loaded via the Web onto the Palm.
This page makes use of an input form with a submit button that sends the form variable to the ColdFusion result page to query and display the results. The resulting page is shown in Figure 8.
Listing 4 shows the ColdFusion code that accepts the form variable from the input page and performs the query to return the results back.
This page makes use of a ColdFusion query tag that selects the list of matching contacts and an output tag that displays the results to the Palm screen. You can see what the page looks like on the Palm in Figure 9.
Developing wireless Web applications gives you the ability to roll out applications to handheld devices. This process allows access to those applications for users at any time and in any place. The Palm platform provides a very nice vehicle for deploying wireless applications in ColdFusion. Acknowledgements
Portions of this article were taken from texts and articles on developing Web clipping applications from the Palm development zone
- Where Are RIA Technologies Headed in 2008?
- The Next Programming Models, RIAs and Composite Applications
- AJAX World RIA Conference & Expo Kicks Off in New York City
- Constructing an Application with Flash Forms from the Ground Up
- Building a Zip Code Proximity Search with ColdFusion
- Personal Branding Checklist
- CFEclipse: The Developer's IDE, Eclipse For ColdFusion
- Has the Technology Bounceback Begun?
- Cloud People: A Who's Who of Cloud Computing
- i-Technology Viewpoint: We Need Not More Frameworks, But Better Programmers
- Adobe Flex 2: Advanced DataGrid
- Web Services Using ColdFusion and Apache CXF