Accessibility
 
 
Adding Wireless Abilities to Existing Macromedia Spectra Applications

Anthony C. McClure
Senior Technologist
RemoteSite Technologies

The Wireless Internet, WAP, WML, 3G, iMode, GPRS, all buzzwords and all getting plenty of attention these days around the water cooler and in the boardrooms of many companies.

The answers to the questions emerging from these encounters may rest on your shoulders -- but fear not! As a current Macromedia Spectra adopter, the tools to leverage this revolution in telecommunications are within your grasp.

This series of articles is not designed to be a primer for WAP (Wireless Access Protocol) and WML (Wireless Markup Language); my colleagues have already covered this area very well. In fact, I recommend reading several articles before continuing on into using Macromedia Spectra along with the wireless Internet:

  1. No Strings Attached - by Ben Forta, which covers the general topic of wireless Web applications, the technology behind it, and how ColdFusion fits in.
  2. Developing Wireless Applications with ColdFusion, Part 1 - by Charles Arehart, which goes into more detail on WML and how ColdFusion may be further used to create dynamic WAP applications.
  3. Developing Wireless Applications with ColdFusion, Part 2 - by Charles Arehart, finishing up his series on creating WAP sites dynamically with ColdFusion. In this article, the author discusses how to be successful in your WAP development efforts, and how to avoid the potential pitfalls of errors and debugging.

What this series will do is provide the reader with an understanding of how to apply the lessons learned from ColdFusion generated WML to an existing Macromedia Spectra Application.

In part one, we will discuss why Macromedia Spectra is ideal for delivery of WAP content and the basics of how we will accomplish this using Macromedia Spectra. In part two, we will go into a deeper discussion of using Macromedia Spectra's handlers and even PLPs to evolve a case study e-commerce site into a wireless Internet application.

Where We Are Now

Macromedia Spectra is a great product for content management and bringing an object methodology to Web applications. By creating object types with associated methods and properties, we can dynamically create extremely flexible systems. To add additional functionality to an existing object, simply create more methods and properties as needed.

This fundamental philosophy of Macromedia Spectra is what will enable us to evolve our sites easily and quickly to the wireless environment. In fact, by doing nothing more than a little browser detection (using Macromedia Spectra's built-in tag) and creating additional WML methods for any relevant content objects, the wireless Internet can be a part of any Macromedia Spectra site!

Take, for example, the case study we will use for this series:

For this case study, we will use a site that should be familiar to any macromedia Spectra developer: RestoreNet. RestoreNet, is a sample e-commerce application that is installed with Macromedia's Spectra.


RestoreNet Home Page

RestoreNet has what any good e-commerce site should have:

  1. A product catalog, including sub-categories like chairs, clocks, and sofas
  2. Individual products to buy
  3. A shopping cart and checkout process
  4. Additional content for flavor
  5. Some personalization features

The RestoreNet CEO has decided that they should move their e-commerce site onto the wireless Web and has come to us to get the job done. Lucky for us, RestoreNet is written in ColdFusion and uses Macromedia Spectra, which will make our lives much easier.

The sites that you are interested in may be similar to this one, or may be completely different and have no e-commerce abilities whatsoever. The important thing is that all sites built using Macromedia Spectra have the same underlying philosophy of content objects with associated methods and properties, and therefore the lessons in this article will apply to them all.

The Fundamentals of Macromedia Spectra and WAP/WML

As other articles have shown, WML documents may be produced in an identical way to the HTML documents you create today. And since Macromedia Spectra applications are built using the ColdFusion Markup Language, Macromedia Spectra WAP pages should be written in a similar way as well.

As a Macromedia Spectra developer, you also know that functionality is executed using a method against a content object. For example, in the RestoreNet case study, each product is a content object of type "rn_catalogitem". When looking up the rs_catalogitem type in the Macromedia Spectra Webtop, the various methods available to this type are listed. Each one of these methods points to a ColdFusion template that contains the code to implement the functionality needed.


Spectra Webtop: rn_catalogitem methods list

For instance, in RestoreNet when a customer selects a product to receive additional information about it, the site makes a call to the "display" method. This method looks up a specific ColdFusion template and renders HTML that is returned to the customer's browser. In a similar way, when a customer wishes to add a product to their shopping cart the site executes a call to the "addtocart" method.

Since the requirement of the RestoreNet case study is to display object information not in a Web browser, but in a WAP enabled device, how would you do this?

You would do this by creating a new method to render the WML just as if the requirement was to display a different set of information in a Web browser. That's all there is to it. Use existing objects and their properties, but create WML instead of HTML display methods to send information back to the WAP device.

Putting All This Together

With this new-found knowledge, the process of integrating the wireless Internet into an existing Macromedia Spectra application is easy.

The following list shows the steps needed to accomplish our goal of adding WAP to RestoreNet.com. In the next installment of this series, we will begin breaking down each one of these steps and will develop the code to make it all happen.

  1. Detect the browser -

  2. (a) WAP devices need to have a specific mime type returned to them and standard HTML will not work. There must be a way to detect these WAP devices and send the customers to the appropriate section of the Web site. Macromedia Spectra once again comes to the rescue with the tag.
  3. Create the methods in Macromedia Spectra to handle our display needs.

  4. (a) For RestoreNet, display categories down to individual products and allow for products to be added to a shopping cart.
    (b) The shopping cart must also have an associated display handler to show all items to purchase.
  5. Code the ColdFusion templates that implement the new methods.

  6. (a) By using standard Macromedia Spectra tags such as <cfa_handler>.
    (b) Adding in WML code for select options, links, and overriding of function keys.
  7. In the case of an e-commerce site, create a new PLP to handle collection of customer information in the checkout process.

  8. (a) Forms in WML must be handled differently than they are in HTML. A deck of WML cards may be used to collect the data, and a PLP to move between the various steps.

Conclusion

The Wireless revolution is here, and is here to stay. Everywhere you turn, the buzzwords of WAP, WML, 3G, etc. flow around us. A new technology does not have to be that difficult, and with Macromedia Spectra, the foundations are readily available to us.

Macromedia Spectra is a wonderful tool to create dynamic, interactive, and content-rich Internet, intranet, and e-commerce sites. By leveraging the abilities inherent to an existing Macromedia Spectra application (content objects, and their properties) a developer can easily add the wireless Internet by simply creating object handlers to serve up WML, instead of HTML.

Make sure and look for part two of this series where the RestoreNet case study will evolve into a wireless application, including a look at the code involved in such an operation.