Why won't Flex Remoting work with ColdFusion?
This question comes in from a reader:
I'm trying to become familiar with Flex remoting and tie to a CFC on the back end.When I run the flex code and press the button I receive the following error: [RPC Fault faultString="[MessagingError message='Destination 'ColdFusion' either does not exist or the destination has no channels defined (and the application does not define any default channels.)']" faultCode="InvokeFailed" faultDetail="Couldn't establish a connection to 'ColdFusion'"]
I'm not quite sure what the problem is, it could be any number of things. Here are some things I suggested that he take a look a:
- Services Config: Did he add the services-config file to your Flex Builder project as command line argument? Bring up project properties and select Flex Compiler. The argument should be something like this:-services c:/CFusionMX7/wwwroot/weborb30/WEB-INF/flex/services-config.xml
If not, you'll want to add it.
- Check Flex Remoting Setup: There could be a problem with the Flex Remoting setup. CAn you load localhost/flex2gateway? If you see a blank page, you're all set. If you see a 404 error, then that is the problem. Is Flash Remoting support enabled from the ColdFusion administrator? Check under Data and Services --> Flex Integration.
- Code: Check your CFC code. Will it work locally, being invoked from a cfm template? Can you generate a WSDL by loading the CFC in the browser with a ?wsdl argument? Although when using Flash Remoting, the WSDL is not needed, loading the WSDL in the browser will make you aware of potential errors w/ remote access.
- Paths: Check the case sensitivity of your paths. If the case is wrong, the Flash Player won't find the CFC.
I've run into all sorts of these problems when trying to get this stuff working the first time. However once I made it over that initial hump I never had to look back.
Hey, did you know over at The Flex Show we're giving away a Nintendo Wii Bundle? CT is in the middle of a heat wave, so I'm gonna get out of the non-air-conditioned office and try to find some cooler places to program at.




The default is
<endpoint uri="http://{server.name}:{server.port}{context.root}/flex2gateway/" class="flex.messaging.endpoints.AMFEndpoint"/>
If you are running the Flex app from a sub folder chances are it can not find the server. You can copy the whole file to another XML file, I have one for each distinct project. i.e. services-config-project1.xml, services-config-project2.xml. This way I can update the config file as needed without breaking other projects.
Let em know if you need more help.
I am guessing that Is that related to the Services Config mentioned. Its all quite new to me. :-)
I've never had problems, nor heard of anyone having problems because the Flex app was in a subfolder. The endpoint, as you state above, is an absolute path. I wouldn't expect sub folders to have any affect.
I have heard about people who use the "different file for each project" approach. I've experimented with it myself, but for most of what I'm doing, the default file works fine.
Yes, you're correct. When you create a Flex Builder Project and specify CF as the "server" all it does it add on the services argument to the compiler string.
How do I loop over a query with AS3? Is the return type of a query an ArrayCollection? Etc. I am figuring them out of course, but seems like a resource of Flex for CF people would be handy.
Cheers,
Davo
It depends what you mean by dynamics. Techincally this is dynamic
{server.name}:{server.port}{context.root}
The Flash Player figures out where to look for the gateway based on the URL that the swf is served from.
You can also bypass the services config file completely using a method described here: http://blog.mikenimer.com/index.cfm/2007/1/10/Bye-...
But I've never used it.
Joshua,
So far as I know there is no book on Flex and CF. I was toying around with the idea of writing one, but it's not gong to happen anytime soon.