The Contact Manager Application and Tutorial for Flex Data Services integration with ColdFusion has a few problems that will cause it to not work. Having worked out the issues, I've created a parallel instruction set for getting this tutorial to work.

Using ColdFusion with Flex: Part 1: Creating and running a contact manager application

Configuring Flex Data Services

  1. Download the into a temporary working directory
  2. Unzip to the current working directory. You'll end up with a directory with the same name contact_manager containing two main subdirectories called dataservice and samples. You'll also find a Readme file with the original form of the Devnet article, although it also has inaccuracies.
  3. Go into the dataservice directory and copy the whole folder called contact/
    (i.e. contact_sampledataservicecontact)
  4. Paste the contact directory into C:FDS2jrun4serversdefaultsamplesdataservice
  5. Directory names are repeated among the nested subdirectories, and it can get confusing quickly. The contact directory contains several mxml files, but it also contains a samples subdirectory containing another contact subdirectory with a file in it. Drilling down, the directory struture should look like the following:
    view plain print about
    2    - contact
    3        - contactmgr.mxml
    4        - Hourglass.mxml
    5        - mini.mxml
    6        - wait.png
    7        - samples
    8            -contact
  6. Make backup copies of the original config files:
    • C:FDS2jrun4serversdefaultsamplesWEB-INFflexdata-management-config.xml
    • C:FDS2jrun4serversdefaultsamplesWEB-INFflexservices-config.xml
  7. Follow the instructions for copying the ColdFusion RTMP and AMF channels from
    C:FDS2 esourcesconfigservices-config.xml to
  8. The article omits to say that the logging level should be changed from Warn to Debug, so change the level in services-config.xml in order to actually see print out on the console.
  9. Open C:FDS2jrun4serversdefaultsamplesWEB-INFflexdata-management-config.xml
  10. Copy the adapter element from the Devnet article
    view plain print about
    1<adapter-definition id="coldfusion-dao" class="coldfusion.flex.CFDataServicesAdapter"/>
    and paste it into the adapters node
  11. Open C:FDS2 esourcesconfigdata-management-config.xml to find the block for "ColdFusion Sample - Contact sample application".
  12. Copy the whole cfcontact desintation node from the data-management-config.xml file in resources/config to the one in ....serversdefaultsamplesWEB-INFflex
  13. The next bullet point is the most important inaccuracy in the Contact Manager app. It would be embarrasing for me to tell you how long it took me to figure this out, but without the following change the app won't work. The Flex grid won't load the initial contact data and if you try add a new contact the Please Wait overlay will just hang forever.
  14. Open contactmgr.mxml under the Flex samples server where you previously copied the mxml files.
    • Find the initApp() function on line 41
    • Find line 44 showing: ds = new DataService("cfcontact-default");
    • Change that to read: ds = new DataService("cfcontact");
    • The DataService instance creation must match the destination id from the Contact Manager App destination node in data-management-config.xml

If you want to use my files, you download the final versions of data-management-config.xml, services-config.xml, and contactmgr.mxml.

Configuring ColdFusion MX 7.02 for FDS Contact Manager App

  1. Back in the temporary working directory where you unzipped, go into contact_manager/ and copy the samples/ subdirectory to the ColdFusion web root, and create a datasource "FlexDataServices" pointing to the mdb file in samples/contact/db/.

Running the application
  1. Start or restart Flex FDS default server using the file C:FDS2jrun4instartJRun.bat
  2. Note Debug logging will output on the console the following:
    [CFDataServicesAdapter] Configuring CFC adapter for destination cfcontact
  3. Browse to: http://localhost:8700/samples/dataservice/contact/contactmgr.mxm (Note the Devnet tutorial has a typo which indicates /cfcontact/ instead of /contact/ in the URL.
  4. You should two Flex panels load, the on the left having a grid with rows of contact data
  5. If you don't see any data, go back and make sure contactmgr.mxml's DataService is created correctly to match the destination id exactly.

Contact Manager App

So is that it? A flash form?

Well, no. The beauty of Flex Data Services is real time data view. While looking at the data in one browser, I can then open the application from another machine, modify the data there, and in my first browser I see the data update and refresh immediately. Imagine teams of people collaborating on the web where everyone see the collective changes right away.