Can't get Flex 2.0 and ColdFusion 7.0.2 to work together in a remote server environment

I have Flex 2.0 and CFMX7.0.2 on a shared server. Whenever I try to use a RemoteObject, I get a "TypeError: Error #1034: Type Coercion failed: cannot convert Object@2f044c1 to mx.messaging.messages.ErrorMessage." error.

There is a great article at:

http://www.adobe.com/devnet/flex/articles/helloworld.html

which helps understand how to use Flex 2.0 and CF 7.0.2 when you have CF running locally. However, after numerous hours, I just can't get this to work when CFMX7.0.2 is running on a remote server.

Do I need to modify my C:\CFusionMX7\wwwroot\WEB-INF\flex\services-config.xml file on the server?

What should I put as my compiler argument (since there is no C drive because the server is remote). I don't assume it is still --services=C:\CFusionMX7\wwwroot\WEB-INF\flex\services-config.xml right?

What I should put in for my RemoteObject source name (the folder of the cfc?)

I can do fine with web services, but can't seem to get data to move through RPC/AMF.

Any help is apprecaited - I assume others are having this same problem. If you have succeeded at running a Flex 2.0 app by moving data through CFMX7.0.2, pleaes comment on this entry.

Thank you! Ken.

PS - See others with the same problem at: http://www.adobe.com/cfusion/webforums/forum/messageview.cfm?catid=585&threadid=1169105&forumid=60

Related Blog Entries

Comments
Ken Reiss's Gravatar Thank you for your help, guys. I have read the Flex 2 with CFMX7.0.2 docs you sent and they were somewhat helpful. I tried all sorts of things and still continue to get the following error message:

[RPC Fault faultString="[MessagingError message='Unknown destination 'ColdFusion'.']" faultCode="InvokeFailed" faultDetail="Couldn't establish a connection to 'ColdFusion'"]
   at mx.rpc::AbstractInvoker/http://www.adobe.com/2006/flex/mx/internal::invoke()
   at mx.rpc.remoting.mxml::Operation/http://www.adobe.com/2006/flex/mx/internal::invoke()
   at mx.rpc.remoting::Operation/send()
   at Function/http://adobe.com/AS3/2006/builtin::apply()
   at mx.rpc.remoting.mxml::Operation/send()
   at testwebservices/___Button2_click()

I am running IIS5.0 with multiple virtual hosts. This is one of the virtual hosts.

I have the following line in my Flex Builder 2:

--services=c:\CFusionMX7\wwwroot\WEB-INF\flex\services-config.xml

and always get a "unable to open 'c:\CFusionMX7\wwwroot\WEB-INF\flex\services-config.xml'" error becaue of course I don't have this file on my development machine - its on my remote server and my local machine can't see it's C:\ drive.

Has ANYONE successfully gotten Flex 2 to work with CFMX7.0.2 on IIS5.0 with multiple domains? If so HOW? I beleive Flex 2 is great, but it won't be any good to me if I can't get it to run on a live production server. I was one of the first ones to buy it back at the end of June, and it's been nearly a month and I still can't make it work.

VERY FRUSTRATED,
Ken.
# Posted By Ken Reiss | 7/23/06 10:55 PM
Ken Reiss's Gravatar I searched my server's entire C drive and don't see the flex2gateway folder anywhere.

Perhaps it's my source attribute? The docs say "The source attribute specifies the dot notation to the CFC from the web root(the classpath to the CFC)." But what is my webroot on a shared server? There is no dot notation to point to it from either my c:\inetpub\wwwroot or c:\cfusionmx7\wwwroot because my CFC is in my e:\ drive in a virtual host folder.
# Posted By Ken Reiss | 7/23/06 10:59 PM
Jeff Houser's Gravatar I struggled with this on Beta 3 for a few days before giving up. The official release, however, just worked for me.

Word "on the street" at CFUNITED was that 7.02 was not cummulative. It can only be installed on top of 7.01. There were no Are you sure you had 7.01 installed first?

I believe that Flex2Gateway is a context root directory; something internal to Flash Remoting. You won't find it on your drive (or defined as a virtual mapping) anywhere.

It also sounds like you're getting confused with how to access CFCs via Dot notation. Unless configured otherwise, Flash Remoting will not look at CF mappings for components, so everything it looks at is relative to the web root.

www ( web root )
components
MyComponents


would be accessed, like this:

components.mycomponents.mycfc

To access a CFC in the web root, just use the CFC name:

mycfc

If we saw some MXML code, that might help to diagnose it. Are you CFCs accesible via the web root of the server in question? Are you sure there are no errors in the CFCs?
# Posted By Jeff Houser | 7/24/06 7:04 PM
Ken Reiss's Gravatar Hi Jeff,

Thanks for your suggestions and help with the dot notation. I guess where I'm stuck is that I am required to put in a project property line pointing to my local machine. But I don't have CF (nor do I want to) on my local machine. I want to have it on a remote server. A few people have suggested that I map the drive on my devel server. That seems to work, but what do I do when I actually deploy for real on a live, external box running IIS with virtual hosts and can't map to the drive through windows. When I do map to my local devel server, every time I click my button, I get a windows authentication pop-up. How is this going to work when I'm live and my client using my swf can't map to my devel server?

Web services work fine to the same CFC, but remoting just wont. With web services I just point to the WSDL address and it runs fine from anywhere on the Internet. With AMF, it seems to want to only talk to my local machines. This can't be true, though, or what good would it be.

Perhaps I'm confusing my web-roots? I know there is one at c:\inetpub\wwwroot and CF has its own at c:\cfusionmx7\wwwroot but I don't use either. I use folders on my E: (RAID-5) drive as my virtual-hosted web roots. How can I point to my CFC there and still use flash remoting?

Perhaps its just that owning an ISP for so long has caused me to see everything as client-server and I'm having a hard time finding the line between the two here. However, it really seems to me that 99% of all Flex 2 developers will run into the problem I am seeing when the go to actually deploy the app on a real, shared server, not on their devel server.

Thank you, again!
Ken.

PS - check out the following URLs which have other peoples ideas:

http://www.adobe.com/cfusion/webforums/forum/messa...

http://www.forta.com/blog/index.cfm/2006/2/1/ColdF...
# Posted By Ken Reiss | 7/24/06 10:43 PM
Jeff Houser's Gravatar I'm off to a meeting, so I'll just give this a quick thought..

Flash, by default, cannot access domains other than the current domain unless a crossdomain.xml file is set up.

A swf running on your localhost will not be able to access a CFC on kenreiss.com

( I thought this same sort of policy applied to Web Services, so perhaps you've already set up a crossdomain.xml file )

Sample Crossdomain.xml, which allows for all domains to access you:

<?xml version="1.0"?>

<!DOCTYPE cross-domain-policy SYSTEM "http://www.macromedia.com/xml/dtds/cross-domain-po...">
<cross-domain-policy>
<allow-access-from domain="*" />
</cross-domain-policy>
# Posted By Jeff Houser | 7/25/06 8:05 AM