I have been wondering about being able to use named remote objects every since MAX 2004, where I learned that because CFMX 6.1 uses an "older" Flash Remoting Gateway it was not possible with Flex 1.5. Now that CFMX 7 utilizes a "newer" Flash Remoting Gateway, I finally took the time over the holiday weekend to try a named remote object call from my Flex 1.5 (running under a Tomcat install) to a CFMX 7 CFC function. In a few days, I plan to try the same thing with an integrated CFMX 7 / Flex 1.5 installation. UPDATE: This also works with an integrated Flex 1.5 and CFMX 7 installation. Here's what I did to make it work:
"Old Way":
<mx:RemoteObject id="BannerRO" endpoint="http://your_domain/flashservices/gateway" source="adbanner.components.flexBanner" showBusyCursor="true">
<mx:method name="flexAuthenticate" result="Login(event)" />
<mx:method name="GetBannerFlex" result="ChooseBanner(event)" />
</mx:RemoteObject>
"New way":
<mx:RemoteObject id="BannerRO" named="flexBanner" showBusyCursor="true">
<mx:method name="flexAuthenticate" result="Login(event)" />
<mx:method name="GetBannerFlex" result="ChooseBanner(event)" />
</mx:RemoteObject>
Here's the changes I made to enable this:
1. Modified the gateway-config.xml in my CFMX 7 WEB-INF folder (in my case, this was found at C:\JRun4\servers\cfusion\cfusion-ear\cfusion-war\WEB-INF).
<security>
<whitelist>
<unnamed>
<source>*</source>
</unnamed>
<named>
<object name="flexBanner">
<source>
adbanner.components.flexBanner
</source>
</object>
</named>
</whitelist>
</security>
2. Modified the flex-config.xml in my Flex 1.5 WEB-INF\flex folder (in my case, this was found at D:\Program Files\Apache Group\Tomcat 5.0\webapps\my_flex\WEB-INF\flex).
<remote-objects>
<!-- The location of the AMF Gateway. The value below is used when
calling a page over http or when protocol is specified as http -->
<amf-gateway>http://your_domain/flashservices/gateway</amf-gateway>
<whitelist>
<named>
<object name="flexBanner">
<source>foo.bar</source>
</object>
</named>
</whitelist>
</remote-objects>
* NOTE: the source (I used foo.bar) can be anything you like, as it's only a placeholder for the named object
3. Restarted CFMX 7 and Flex 1.5.
4. Ran my Flex apps successfully. |