Thanks for the excellent reply. You saved the day.
We do have CF working with Flex. There's also the Phones example on the Adobe Labs site that shows this connectivity. All of this is working fine. The challenge we were having was with the new version of Cairngorm. We have been using ARP for a flash application that is to be migrated to flex2 and we need to get a bit of advice from the creator of Cairngorm -- who is now Adobe, to suggest a best practice example that shows how coldfusion is the "perfect mate" for flex2. The login example that was given is a bit too simplified and also did not include how coldfusion. If Adobe wants to sell coldfusion with flex, then it would be beneficial to demonstrate via examples how things could work together. Anyhow, aside from our wish list to Adobe, Merci Beaucoup for your excellent tutorial and sharing your experiences, especially the bugs. BTW, are you using Cairngorm2 yet? or what type of architecture are you using. P.S. I used your Benorama architecture for a project and was very happy with it. What are your thoughts on Cairngorm and the upcomming ARP3 for flex2. Cheers, Tim --- In flexcoders@yahoogroups.com, "Benoit Hediard" <[EMAIL PROTECTED]> wrote: > > This sample app also shows how CFC/AS3 VO mappings (or remote class alias) > works. > > Have fun! > > Benoit Hediard > > -----Message d'origine----- > De : flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] De la > part de Benoit Hediard > Envoyé : mardi 7 février 2006 20:37 > À : flexcoders@yahoogroups.com > Objet : [flexcoders] Flex/Coldfusion connectivity test app > > Since some people seems to have issues to use the Flex/ColdFusion > connectivity, here is a sample app to test your connectivity. > > ------------------------ > ColdFusion / Server side > ------------------------ > > Save the following value object CFC in > {wwwroot}/com/mycompany/myapp/model/TestVO.cfc > <cfcomponent> > > <cfproperty name="someString" type="String" /> <cfproperty name="someNumber" > type="Numeric" /> > > <cffunction name="init" returntype="com.mycompany.myapp.model.TestVO"> > <cfscript> > this.someString = "test"; > this.someNumber = 0; > </cfscript> > <cfreturn this /> > </cffunction> > > </cfcomponent> > > Save the following remote service CFC in > {wwwroot}/com/mycompany/myapp/service/TestService.cfc > <cfcomponent> > > <cffunction name="getArray" access="remote" returntype="Array"> > <cfscript> > var data = arrayNew(1); > arrayAppend(data, createObject("component", > "com.mycompany.myapp.model.TestVO").init()); > arrayAppend(data, createObject("component", > "com.mycompany.myapp.model.TestVO").init()); > </cfscript> > <cfreturn data /> > </cffunction> > > <cffunction name="getStruct" access="remote" returntype="Struct"> > <cfscript> > var data = structNew(); > data.firstData = createObject("component", > "com.mycompany.myapp.model.TestVO").init(); > data.secondData = createObject("component", > "com.mycompany.myapp.model.TestVO").init(); > </cfscript> > <cfreturn data /> > </cffunction> > > <cffunction name="receiveAndReturnVO" access="remote" > returntype="com.mycompany.myapp.model.TestVO"> > <cfargument name="vo" type="com.mycompany.myapp.model.TestVO"> > <cfreturn arguments.vo> > </cffunction> > > </cfcomponent> > > ------------------ > Flex / Client side > ------------------ > > Save the following value object in {some test > project}/com/mycompany/myapp/model/TestVO.as > package com.mycompany.myapp.model { > > [Bindable] > [RemoteClass(alias="com.mycompany.myapp.model.TestVO")] > > public class TestVO { > > public var someString:String; > public var someNumber:int; > > public function TestVO() { > someString = ""; > someNumber = 0; > } > > } > > } > > Save the following test application in Flex Builder 2 {some test > project}/TestConnectivity.mxml <?xml version="1.0" encoding="utf-8"?> > <mx:Application xmlns:mx="http://www.macromedia.com/2005/mxml" xmlns="*"> > > <mx:RemoteObject id="testService" > destination="ColdFusion" > result="onResult(event)" > source="com.mycompany.myapp.service.TestService" /> > > <mx:Script> > <![CDATA[ > import com.mycompany.myapp.model.TestVO; > import mx.controls.Alert; > import mx.rpc.events.ResultEvent; > import mx.utils.ObjectUtil; > > private function onResult(event:ResultEvent){ > Alert.show(ObjectUtil.toString(event.result)); > } > ]]> > </mx:Script> > > <mx:Button label="getArray" click="testService.getArray()" /> > > <mx:Button label="getStruct" click="testService.getStruct()" /> > <!-- BUGS : display (null) value instead of objects, but objects are > correctly returned... --> > > <mx:Button label="receiveAndReturnVO" > click="testService.receiveAndReturnVO(new TestVO())" /> > > </mx:Application> > > Compile and run TestConnectivity.mxml (do not forget to set the compile > argument to take into account your flex/coldfusion service definition, > "flex-enterprise-services.xml") > > It should work, if your ColdFusion server is correctly configured with the > Flex/ColdFusion connectivity add-on. > You can also check the adapter logs in > {CFusionMX7}/runtime/logs/coldfusion-out.log, very nice to see if the typed > objects are correctly received or sent by the ColdFusion adapter. > > ---- > BUGS > ---- > > We have faced several bugs with the Flex/ColdFusion connectivity. > > 1. In the above sample app, getStruct() display (null) object in the Flex > app, but objects are correctly returned... Strange. > > 2. Sometimes, the AS -> CFC does not map the full type correctly. > Example : the CFC might receive "TestVO" instead of > "com.mycompany.myapp.model.TestVO", so the CFC argument type validation will > fail and you will get an error... > The current workaround is to remove typed object validation in remote > service CFCs. > > 3. You might have to add UPPERCASE setter functions for CFC -> AS > translation to work correctly. > We don't know yet when it is necessary... But sometimes it does! > > Example in TestVO.as : > public function set SOMESTRING(value:String):void { > this.someString = value; > } > > public function set SOMENUMBER(someNumber:int):void { > this.someNumber = someNumber; > } > > --------------------------- > COLDFUSION WITH CAIRNGORM 2 > --------------------------- > > In order to use your service CFCs in a cairngorm application, you just need > to add the RemoteObject definition in your ServiceLocator definition file. > > Hope this helps! > > Benoit Hediard > > > > > > > -- > Flexcoders Mailing List > FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt > Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com > Yahoo! Groups Links > -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/flexcoders/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/