Earlier this month, Adobe released the latest version of ColdFusion at the MAX conference in Los Angeles. Back in July I gave an overview of ColdFusion 9, covering some of the new features with the benefit of Kay Smoljak’s examples. This article is about one juicy new feature that we omitted in that article: ColdFusion as a service (CFaaS).
CFaaS is a new way of accessing some of ColdFusion’s functionalities as remote or local services. For example,
<CFDOCUMENT>, which were previously only available as CFML tags and could therefore only be used in
.cfm documents running on your server. With CFaaS, your client-side code can access these ColdFusion functionalities with web service calls.
With the current trend towards richer applications based on Flash, Flex, AIR, or AJAX on the client side, it made sense for Adobe to give ColdFusion 9 a service layer. This allows RIA developers to leverage some of ColdFusion’s rapid application development functionality in their work.
To illustrate how you can take advantage of this new service layer, I’ll show you how to build a simple AIR application that will act as a front end for image processing tasks taking place on the server side. We want to be able to drag and drop an image into the application, upload it to a ColdFusion server, perform some CFaaS functionality to modify the image, then retrieve the image to be displayed in our application. Finally, users will be able to drag and drop the modified image back into their file system as a JPEG file.
Before we start, here’s what you’ll need:
ColdFusion 9 from Adobe. Download and install the free developer edition.
Flash Builder 4 beta 2 from Adobe Labs, which we’ll use to build our AIR app. We’ll be using the Flex 3.4 SDK, so you could in theory use Flex Builder 3 for most of what we’ll be doing, but Flash Builder 4 will simplify a few key tasks.
The sample code, which is available here. The archive includes both an
.fxpproject that you can import into Flash Builder, and the raw source files in case you want to look at them on their own.
Once you’re done reading the article, head over and test your new skills in our Article Quiz!
Before we start working through the example, let’s have a look at some basic CFaaS features and how we can make use of them. In ColdFusion 9, the following tags and their functionality are available as SOAP/WSDL-based web services:
The WDSL URLs for these services follow the format:
http://<servername>:<port>/CFIDE/services/<servicename>.cfc?wsdl. So, if you installed ColdFusion 9 on your local machine using its built-in HTTP server, the WSDL URL to access the image service will be:
http://localhost:8500/CFIDE/services/image.cfc?wsdl. All the examples and sample code will be using this format, so if you’re using a different server name or port, you’ll need to adjust the URLs accordingly.
The WSDL URL of a service essentially exposes the entire service API, and this can pose a significant security risk. Because of this, the CFaaS engine is disabled by default, so you (or your ColdFusion server administrator) will need to set up a user account for the CFaaS layer and provide that user with appropriate access to the individual services. You’ll also need to provide a list or range of IP addresses that are permitted to access exposed services. For the purpose of this exercise we’ll just be accessing the service from our local machine, so you’ll only need to add
127.0.0.1 to that list.
To add the user for our service, we’ll first log in to the ColdFusion server administration area, located at
http://localhost:8500/CFIDE/administrator/index.cfm. The two screens we’ll need are both found in the Security section: User Manager and Allowed IP Addresses.
First, in the User Manager screen, create a user, specifying a username and password. At the bottom of the screen, move Image Service from the list of prohibited services to the list of exposed services.
Nevermind the other sections of this form, you can leave them alone for the purposes of this application. Make sure to remember the username and password you set for your new user, as you’ll need them to permit your AIR app to access the image service.
Wrapping Your Head Around Python
Introduction to Swift
Jump Start Git
Level Up Your Web Apps With Go
Jump Start MySQL
Jump Start Git
- 1 How to Take Advantage of the Psychology of Speed Perception
- 2 Data Serialization Comparison: JSON, YAML, BSON, MessagePack
- 3 Versioning Show, Episode 0, with M. David Green and Tim Evko
- 4 Shiny, R and HTML: Merging Data Science and Web Development