Loading ...
Sorry, an error occurred while loading the content.
 

Flex/Coldfusion connectivity test app

Expand Messages
  • Benoit Hediard
    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
    Message 1 of 14 , Feb 7, 2006
      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
    • Benoit Hediard
      Yes, it works, but first of all, you need to test your Flex/ColdFusion connectivity (without Cairngorm). See the message I just sent few minutes ago, with a
      Message 2 of 14 , Feb 7, 2006
        Yes, it works, but first of all, you need to test your Flex/ColdFusion
        connectivity (without Cairngorm).
        See the message I just sent few minutes ago, with a sample app.

        Then, to use your service CFCs in a cairngorm application, you just need to
        add the RemoteObject definition in your ServiceLocator definition file.

        Good luck!

        Benoit Hediard

        -----Message d'origine-----
        De : flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] De la
        part de sufibaba
        Envoyé : mardi 7 février 2006 18:36
        À : flexcoders@yahoogroups.com
        Objet : [flexcoders] Does Cairngorm work at all with the new flex2
        coldfusion adapter.

        Hi,

        We've posted a few questions about cairngorm alpha and coldfusion and so far
        no replies. ( no replies, as we have learned from our past experiences with
        cairngorm means that there might be problems...
        however, it could also be that everyone is so busy)

        Does anyone have experience with Cairngorm alpha with coldfusion -
        flex2 beta adapter. Please provide a small example of how to setup
        cairngorm alpha with coldfusion.

        Perhaps someone from the cairngorm team can reply to this question because
        it will help for the early adoption of Cairngorm as opposed to
        ARP3 as an architecture platform.

        Cheers,

        Tim





        --
        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
      • Benoit Hediard
        This sample app also shows how CFC/AS3 VO mappings (or remote class alias) works. Have fun! Benoit Hediard ... De : flexcoders@yahoogroups.com
        Message 3 of 14 , Feb 7, 2006
          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:flexcoders@yahoogroups.com] 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
        • sufibaba
          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
          Message 4 of 14 , Feb 7, 2006
            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" <ben@...> 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:flexcoders@yahoogroups.com]
            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
            >
          • Steven Webster
            Hey, Further to Matt Chotin s post, most of the technical members of the Adobe team are in San Jose at an internal summit right now, so we re not responding to
            Message 5 of 14 , Feb 7, 2006
              Hey,

              Further to Matt Chotin's post, most of the technical members of the Adobe team are in San Jose at an internal summit right now, so we're not responding to emails in our usual fashion.

              I personally don't have an example of integrating Cairngorm 2 and Flex 2 with the Coldfusion adapter; seems like Benoit has given you some great hints, and there are a whole load of other folks that no much more about CF than I do that might be able to give you some help. It's an open-source project, so when you figure it out, if you can post back to the community then that's how the knowledge grows and the knowledge shares.

              If you're having specific problems, and can post a short example of what's not working and what you've tried, I'm sure someone will be able to figure it out and move you along.

              Best wishes,

              Steven

              --
              Steven Webster
              Practice Director (Rich Internet Applications)
              Adobe Consulting
              Westpoint, 4 Redheughs Rigg, South Gyle, Edinburgh, EH12 9DQ, UK
              p: +44 (0) 131 338 6108
              m: +44 (0) 7917 428 947
              swebster@...



              > -----Original Message-----
              > From: flexcoders@yahoogroups.com
              > [mailto:flexcoders@yahoogroups.com] On Behalf Of Benoit Hediard
              > Sent: 07 February 2006 11:39
              > To: flexcoders@yahoogroups.com
              > Subject: RE: [flexcoders] Does Cairngorm work at all with the
              > new flex2 coldfusion adapter.
              >
              > Yes, it works, but first of all, you need to test your
              > Flex/ColdFusion connectivity (without Cairngorm).
              > See the message I just sent few minutes ago, with a sample app.
              >
              > Then, to use your service CFCs in a cairngorm application,
              > you just need to add the RemoteObject definition in your
              > ServiceLocator definition file.
              >
              > Good luck!
              >
              > Benoit Hediard
              >
              > -----Message d'origine-----
              > De : flexcoders@yahoogroups.com
              > [mailto:flexcoders@yahoogroups.com] De la part de sufibaba
              > Envoyé : mardi 7 février 2006 18:36 À :
              > flexcoders@yahoogroups.com Objet : [flexcoders] Does
              > Cairngorm work at all with the new flex2 coldfusion adapter.
              >
              > Hi,
              >
              > We've posted a few questions about cairngorm alpha and
              > coldfusion and so far no replies. ( no replies, as we have
              > learned from our past experiences with cairngorm means that
              > there might be problems...
              > however, it could also be that everyone is so busy)
              >
              > Does anyone have experience with Cairngorm alpha with coldfusion -
              > flex2 beta adapter. Please provide a small example of how to
              > setup cairngorm alpha with coldfusion.
              >
              > Perhaps someone from the cairngorm team can reply to this
              > question because it will help for the early adoption of
              > Cairngorm as opposed to
              > ARP3 as an architecture platform.
              >
              > Cheers,
              >
              > Tim
              >
              >
              >
              >
              >
              > --
              > 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
              >
              >
              >
              >
              >
              >
              >
            • Benoit Hediard
              Hi Tim, ... Yes, we are using Cairngorm2 on a pretty large Flex/ColdFusion project. Our architecture : - ColdFusion MX 7 Standard + Flash Media Server 2 + SQL
              Message 6 of 14 , Feb 8, 2006
                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:flexcoders@yahoogroups.com] 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" <ben@...> 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:flexcoders@yahoogroups.com]
                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
              • Dirk Eismann
                Hi Ben, ... 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
                Message 7 of 14 , Feb 8, 2006
                  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.
                • Benoit Hediard
                  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
                  Message 8 of 14 , Feb 8, 2006
                    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:flexcoders@yahoogroups.com] 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
                  • Dave Carabetta
                    ... 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
                    Message 9 of 14 , Feb 8, 2006
                      On 2/8/06, Dirk Eismann <DEismann@...> 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.
                    • sufibaba
                      Ben, I would love to see a new reincarnation of Benorama. Bravo to Flex2/ColdFusion7 best practices! And of course with your excellent internationalization
                      Message 10 of 14 , Feb 8, 2006
                        Ben,

                        I would love to see a new reincarnation of Benorama.

                        Bravo to "Flex2/ColdFusion7 best practices!"

                        And of course with your excellent internationalization solutions.

                        Speaking of I18, how are you handling I18 with your current flex
                        coldfusion, coldspring, Modelglue architecture.

                        Cheers,

                        Tim


                        --- In flexcoders@yahoogroups.com, "Benoit Hediard" <ben@...> wrote:
                        >
                        > 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:flexcoders@yahoogroups.com]
                        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" <ben@> 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:flexcoders@yahoogroups.com]
                        > 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
                        >
                      • anopres
                        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
                        Message 11 of 14 , Mar 1, 2006
                          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" <ben@...> 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 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
                          >
                        • Benoit Hediard
                          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 , Ex. :
                          Message 12 of 14 , Mar 2, 2006
                            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:flexcoders@yahoogroups.com] 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" <ben@...> 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 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
                          • anopres
                            I found the issue. CF is returning the object type in all lowercase, so instead of seeing com.mycompany.myapp.model.TestVO, I see
                            Message 13 of 14 , Mar 2, 2006
                              I found the issue. CF is returning the object type in all lowercase,
                              so instead of seeing com.mycompany.myapp.model.TestVO, I see
                              com.mycompany.myapp.model.testvo.

                              Is there a setting in one of the config files that would preserve the
                              case? I currently have version 7,0,2,126814 of CF installed.

                              If I change everything to lowercase, it works correctly.

                              Any thoughts?

                              --- In flexcoders@yahoogroups.com, "Benoit Hediard" <ben@...> wrote:
                              >
                              > 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:flexcoders@yahoogroups.com]
                              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" <ben@> 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 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
                              >
                            Your message has been successfully submitted and would be delivered to recipients shortly.