Connecting Abobe AIR (beta) to Coldfusion via mx:RemoteObject
While Flex 3 and AIR are still in beta, there are lots of little bugs and quirks that need to be worked around. Today I was porting over a Flex application to AIR, and received an error whenever using mx:RemoteObject. It looked something like the following:
[RPC Fault faultString="Send failed" faultCode="Client.Error.MessageSend" faultDetail="Channel.Connect.Failed error NetConnection.Call.Failed: HTTP: Failed: url: 'http://myApp-debug.swf/flex2gateway/'"]
I searched for hours and hours trying to find out why my application worked correctly as a regular Flex application but not as an AIR app. I finally stumbled upon the solution and I thought I would share… in order to save everyone else the same headache. The key is to explicitly specify the endpoint attribute in the RemoteObject tag. If you are testing locally it may look something like this:
destination="ColdFusion"
showBusyCursor="true"
endpoint="http://localhost:8500/flex2gateway"
source="myApp.cfc.cfcName" />
This is something I hope Adobe will fix before the official release of both these applications, but in the meantime, here is your workaround.
Update: After working with AIR for a while, I realize, of course, that this is not actually a bug. AIR does not have the same server context that Flex has, and therefore, an endpoint is required. The thing to remember when porting an application from Flex to AIR is not to forget the endpoint, or AIR won’t know what server it is supposed to connect to.
Tags: endpoint, RemoteObject
Thanks! saved my life!
Dude, you rock! Saved me a headache for sure!
Thanks for the info. Once I added the endpoint the application worked great.
Holy Sh$t! That worked.
Thanks Kalen!
Thank you!!! After lots of searching I found your post and this fixed my problem!! Adding the endpoint worked, though I did have to use http://localhost:8500/flex2gateway/ (with a final slash) instead of http://localhost:8500/flex2gateway for it to work for me.
Thanks dude, you save me a lot!!! keep up posting those weird things! :p haha!! at first thought, it should have work out, but again, something simple was missing… thanks
David