10 Replies Latest reply on Nov 9, 2009 1:13 PM by DLCKid

    Passing ArrayCollection from Flex to CFCs

    DLCKid

      I currently have a flex app setup using WebServices to communicate between the app and my CFCs.  Everything works well until I attempt to pass across my dataGrid information which are setup as ArrayCollections.  I have searched and searched and every example and/or response I've found results in more errors.  I've attempted passing the arrayCollection.source attribute into an array argument which gives me an error.  The only thing I found to not throw an error is passing the arrayCollection into a CFC struct.  This only provides me with a struct of objects and no data.  Any ideas on things I am missing?  I can post code if need be, however, I was hoping it was just an easy fix due to something simple I'm forgetting. 

       

      Thanks!

        • 1. Re: Passing ArrayCollection from Flex to CFCs
          Michael Borbor Level 4

          Check the Flex documentation for serializing Flex to CF, or just set

          any in the remote argument type.

           

          Sincerely,

           

          Michael

           

          Sent from my iPhone

           

          El 06/11/2009, a las 9:44, DLCKid <forums@adobe.com> escribió:

           

          >

          I currently have a flex app setup using WebServices to communicate

          between the app and my CFCs.  Everything works well until I attempt

          to pass across my dataGrid information which are setup as

          ArrayCollections.  I have searched and searched and every example

          and/or response I've found results in more errors.  I've attempted

          passing the arrayCollection.source attribute into an array argument

          which gives me an error.  The only thing I found to not throw an

          error is passing the arrayCollection into a CFC struct.  This only

          provides me with a struct of objects and no data.  Any ideas on

          things I am missing?  I can post code if need be, however, I was

          hoping it was just an easy fix due to something simple I'm forgetting.

          >

          Thanks!

          >

          • 2. Re: Passing ArrayCollection from Flex to CFCs
            DLCKid Level 1

            Yea I forgot to mention, seems weird to me but when i set the remote argument type to "any" I get the following error:

             

            "faultCode:DecodingError faultString:'SOAP Response cannot be decoded. Raw response: ' faultDetail:'null'"

             

            I've seen this error numerous times and unsure how to fix this or get my arrayCollection to pass through.

            • 3. Re: Passing ArrayCollection from Flex to CFCs
              Michael Borbor Level 4

              Un the remote object you're setting the access property as?

               

              Sincerely,

               

              Michael

               

              Sent from my iPhone

               

              El 06/11/2009, a las 10:14, DLCKid <forums@adobe.com> escribió:

               

              >

              Yea I forgot to mention, seems weird to me but when i set the remote

              argument type to "any" I get the following error:

              >

              "faultCode:DecodingError faultString:'SOAP Response cannot be

              decoded. Raw response: ' faultDetail:'null'"

              >

              I've seen this error numerous times and unsure how to fix this or

              get my arrayCollection to pass through.

              >

              • 4. Re: Passing ArrayCollection from Flex to CFCs
                DLCKid Level 1

                Here are the basic pieces of my coding stripped apart...

                 

                Flex App:

                 

                <mx:WebService id="cfdata" wsdl="http://localhost:8500/ProfileTest-debug/cfc/myStuff.cfc?wsdl" useProxy="false">

                     <mx:operation name="sendData" result="send_Result(event)" fault="send_Fault(event)" />

                </mx:WebService>

                 

                AS file:

                 

                private var getconsent:ArrayCollection = new ArrayCollection([
                    {LocationName:'Service A', Contact: 'Bob Jones' }, 
                    {LocationName:'Service B', Contact: 'Jane Smith' },
                    {LocationName:'Service c', Contact: 'Doug Johnson' },  
                    {LocationName:'Service d', Contact: 'John Jackson'}  
                    ]);

                 

                // Both getconsent and getconsent.source throw same error

                cfdata.sendData.send(getconsent.source);

                 

                CFC:

                 

                <cffunction name="sendData" access="remote" returntype="void"> 
                        <cfargument name="getconsent" type="any" required="yes">

                • 5. Re: Passing ArrayCollection from Flex to CFCs
                  Michael Borbor Level 4

                  Why don't you use a RemoteObject instead of a WebService?

                  • 6. Re: Passing ArrayCollection from Flex to CFCs
                    DLCKid Level 1

                    I guess because I also got errors trying to set one up and never understood the differences between them?

                    • 7. Re: Passing ArrayCollection from Flex to CFCs
                      Michael Borbor Level 4

                      The advantage of the RO over WS is less bandwith usage, which means

                      data coming an going across the wire faster, and better response time

                      in your app.

                       

                      I strongly recommend you to use RemoteObjects over WS whenever it's

                      possible.

                       

                      Sincerely,

                       

                      Michael

                       

                      Sent from my iPhone

                      • 8. Re: Passing ArrayCollection from Flex to CFCs
                        DLCKid Level 1

                        Ok, I'll look up how to incorporate them instead.  In doing so, can you think of anything that would be skipped or easily missed in regards to setting up my server to handle the RO and/or the LCDS?

                        • 9. Re: Passing ArrayCollection from Flex to CFCs
                          Michael Borbor Level 4

                          No I don't think so, everything comes already set up already if you're

                          using CF 8.

                           

                          Sincerely,

                           

                          Michael

                           

                          Sent from my iPhone

                           

                          El 06/11/2009, a las 11:30, DLCKid <forums@adobe.com> escribió:

                           

                          >

                          Ok, I'll look up how to incorporate them instead.  In doing so, can

                          you think of anything that would be skipped or easily missed in

                          regards to setting up my server to handle the RO and/or the LCDS?

                          >

                          • 10. Re: Passing ArrayCollection from Flex to CFCs
                            DLCKid Level 1

                            Ok, after further review and attempts, clearly I don't understand RemoteObjects like I thought I would.  Are there any tricks to them?  What do I need to setup in order for them to work properly?  If I have all of my ColdFusion functions contained in a CFC, how to I access them using ROs?  Specifically, what are the source values that would work?  I'm working on building the application locally on my machine to then later build for deployment on a different web server.

                             

                            Thanks.