RE: [flexcoders] Re: Flex/Coldfusion connectivity test app
To get a typed object on the Flex side, there is nothing specific to do, you only need to correctly define : - in the CFC VO , all the cfproperty, Ex. : cfproperty name=someString type=String / - in the service CFC cffunction, the correct returnType, Ex. : returntype=com.mycompany.myapp.model.TestVO - in the AS3 VO, the alias metadata, Ex. : [RemoteClass(alias=com.mycompany.myapp.model.TestVO)] - in the AS3 VO, all the public var properties Ex. : public var someString:String; You might also check 2 things, to see what's going on : - on the ColdFusion server side, check the CF Adapter logs in CFusionMX7/runtime/logs/coldfusion-out.log, - on the Flex client side, install ServiceCapture, http://kevinlangdon.com/serviceCapture/, you will see if the returned objects are correctly typed. Benoit Hediard -Message d'origine- De : flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] De la part de anopres Envoyé : jeudi 2 mars 2006 05:42 À : flexcoders@yahoogroups.com Objet : [flexcoders] Re: Flex/Coldfusion connectivity test app How do you use the typed object that cf returns? All I seemt to get is a generic object on the Flex side. Do you have to run through a bunch of set functions to move the properties returned into a pre-existing .as typed object? Sorry for the noob question, but this one has been bugging me for a while. --- In flexcoders@yahoogroups.com, Benoit Hediard [EMAIL PROTECTED] wrote: 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
RE: [flexcoders] Re: Flex/Coldfusion connectivity test app
Hi Tim, are you using Cairngorm2 yet? Yes, we are using Cairngorm2 on a pretty large Flex/ColdFusion project. Our architecture : - ColdFusion MX 7 Standard + Flash Media Server 2 + SQL Server 2005 (we do not plan to use Flex Enterprise Services), - Flash (Flex 2). Frameworks used : - ColdSpring to handle our CFC-based model/service layers, - Model-Glue to handle our CFC/CFM-based view/controller layers for the HTML client, - Cairngorm to handle our AS3/MXML model/view/controller layers for the Flash client. I'm a big fan of those three frameworks : lightweight and powerful. We never used ARP, so I have no opinions on it. As soon as I have some times (maybe this week-end...), I'll write a sample Flex/ColdFusion application (probably, a Cairngorm 2 version of Ben Forta's Phones app). Benoit Hediard PS: Later this year, I also plan to rebuild entirely benorama.com (not updated since 2002 for CFMX launch...), in order to put all the latest Flex2/ColdFusion7 best practices! -Message d'origine- De : flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] De la part de sufibaba Envoyé : mardi 7 février 2006 23:08 À : flexcoders@yahoogroups.com Objet : [flexcoders] Re: Flex/Coldfusion connectivity test app 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 = ;
RE: [flexcoders] Re: Flex/Coldfusion connectivity test app
Hi Ben, Frameworks used : - ColdSpring to handle our CFC-based model/service layers, that's very interesting. We also thought about giving ColdSpring a try - do you recommend it? It's a very young project and still in alpha so I wonder if you had any issues with it in a production environment. Dirk. -- 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/
RE: [flexcoders] Re: Flex/Coldfusion connectivity test app
I recommend ColdSpring, we use it to implement our model CFC factory (beanFactory). It is very nice when you have a complex model with a lot of CFCs and complex CFCs composition/dependencies. (we have not tested the AOP features) We don't use yet on production server, but it should not have any performance issues, since the framework is only called at application start-up to read the xml config file and creating/wiring all your model CFCs. The 1.0 release is very nearby. So, yes, you should give it a try: http://www.coldspringframework.org/ Benoit Hediard PS: the other framework we are using is CF Unit (http://cfunit.sourceforge.net/), to test our CFC-based model/service layers. A must when working with Flex, to be sure that your remote services are correctly working! -Message d'origine- De : flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] De la part de Dirk Eismann Envoyé : mercredi 8 février 2006 11:06 À : flexcoders@yahoogroups.com Objet : RE: [flexcoders] Re: Flex/Coldfusion connectivity test app Hi Ben, Frameworks used : - ColdSpring to handle our CFC-based model/service layers, that's very interesting. We also thought about giving ColdSpring a try - do you recommend it? It's a very young project and still in alpha so I wonder if you had any issues with it in a production environment. Dirk. -- 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/
Re: [flexcoders] Re: Flex/Coldfusion connectivity test app
On 2/8/06, Dirk Eismann [EMAIL PROTECTED] wrote: Hi Ben, Frameworks used : - ColdSpring to handle our CFC-based model/service layers, that's very interesting. We also thought about giving ColdSpring a try - do you recommend it? It's a very young project and still in alpha so I wonder if you had any issues with it in a production environment. Dirk, It's worth noting that while seemingly an alpha because of it's pre-1.0 status, it's very much a 1.0 release in terms of stability. The reason it's not officially at 1.0 is because the creators of it are conservative with their version numbering and also because they said they are working on some Flash Remoting-specific features that they want to get into the official 1.0 release. Head over to www.coldspringframework.org for more info, including an excellent tutorial paper to move you along. Regards, Dave. -- 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/