Real World, How To Use Flex Data Services with Coldfusion
In the ColdFusion MX Administrator, define a ColdFusionMapping for /samples that points to the/samples directory that you created in your web root. This step is required because Flex does not invoke the CFC using HTTP; as a result, the normal web server mappings are not available to resolve the component path.
The samples directory he refers to is the directory that contains your CFCs. Use the CFC wizards to create your CFCs and have them put into that folder. As soon as I created the CF Mapping, I had data in my flex app.
The documentation for getting Flex Data Services to work with Coldfusion is accurate, whatever you use, I've used them all - except for four key real-world steps that I will bring to light right now.
In data-management-config.xml you create a destination. Inside the destination tags is a set of properties tags, and inside the properties tags, there is a set of component tags. This is where you indicate where your CFCs are. Here's what it looks like when properly configured for this example:
So what if you put your cfcs into a cfcs folder inside of the samples? Then the code between the component tags would be:
Also within the properties tags, there is one other tag you will want some real world info about:
There is a set of tags called hostname, and it is very important to have configured correctly. These tags are to be configured with your Coldfusion Hostname. Default is localhost.
I have a development environment that uses a domain name, not localhost. In this set of tags you enter the base URL to your Coldfusion Host (www.myCFServer.com). I should point out that the URL I use to browse my Flexapp is different. Remember that I mentioned in my previous blog entry that using the JRun Web Config tool on an IIS site to connect the IIS site with JRun, renders CF broken; it won't run CF files anymore. Therefore you must use separate IIS sites for CF and Flex apps. I use a hostheader in a separate IIS site for my flex app like this: flexapp.myCFServer.com. But in this set of hostname tags to find the CFCs, I use the IIS site for browing Coldfusion sites (www.myCFServer.com). You should be able to browse right to the CFC and it will auto-launch the CFC Explorer after logging in.
You will get a number of errors if you don't configure everything correctly. I should mention that I have not done anything to the services-config.xml except to copy and paste the RMTP and AMF Polling CF connection code as mentioned in all of the tutorials I have seen for Flex Data Services. I have made no alterations there.
Here are a couple of errors that I got really used to seeing which you might encounter:
java.net.ConnectException: Connection timed out: connect" faultCode="Server.Processing" faultDetail="null"]
Ok so having the benefit of this knowledge (which took me about 12 hours to figure out on my own) to add to your favorite FDS with CF tutorial, should drastically speed up your success so you can move on with your Flex app more quickly than I did. I hope this indeed helps you.
If you happen to see Tom Jordahl, thank him for me. I couldn't have figured it out without him.

![Validate my RSS feed [Valid RSS]](/images/valid-rss.png)

what happens if your app switch from rtmp connection to cf-polling? Does it still works?
so it must work. :)
Anyway Ben mentioned on his blog
"Flex Data Service can be integrated in to the ColdFusion installation. This way ColdFusion can call Flex API's directly (rather than via the current RMI connection) providing a signification performance boost."
This will for sure also avoid all this kind of installations.
Perhaps with Scorpio they'll switch features around so that small clients can get the performance boost of using FDS with CF's JRun in CF Standard.
Try get into the beta :)
Anyway if you have any questions about CF & FDS feel free to ping me offline.
http://drinkmenow.info