9 Replies Latest reply on Aug 6, 2010 7:30 AM by jfb00

    flex and application.cfc

    jfb00 Level 3

      Hi All,

      I'm running flex 3.5 and coldfusion 8.

      If I add my application.cfc in my flex folder my flex app have an error calling cfc's.


      [RPC Fault faultString="coldfusion.runtime.AbortException" faultCode="Server.Processing" faultDetail="null"]
          at mx.rpc::AbstractInvoker/http://www.adobe.com/2006/flex/mx/internal::faultHandler()[C:\autobuild\3.5.0\frameworks\p rojects\rpc\src\mx\rpc\AbstractInvoker.as:290]
          at mx.rpc::Responder/fault()[C:\autobuild\3.5.0\frameworks\projects\rpc\src\mx\rpc\Responder .as:58]
          at mx.rpc::AsyncRequest/fault()[C:\autobuild\3.5.0\frameworks\projects\rpc\src\mx\rpc\AsyncR equest.as:103]
          at NetConnectionMessageResponder/statusHandler()[C:\autobuild\3.5.0\frameworks\projects\rpc\ src\mx\messaging\channels\NetConnectionChannel.as:581]
          at mx.messaging::MessageResponder/status()[C:\autobuild\3.5.0\frameworks\projects\rpc\src\mx \messaging\MessageResponder.as:222]


      What do I need to configure in my application.cfc to make this to work?




        • 1. Re: flex and application.cfc
          Balaji Sridhar



          Can you elaborate the use case in detail? Is your requirement is to talk to a server CFC and connect to Flex app?


          Are you using Flash Builder 4 for your development?





          • 2. Re: flex and application.cfc
            jfb00 Level 3

            Thanks for you reply and help.

            Yes, I'm using flash builder 4.

            I can connect to cfc using this code:

            <mx:RemoteObject id="WCM_RO" destination="ColdFusion" source="myAppPath.cfcs.budget">
                    <mx:method name="getBudgets" result="getBudgetsRO_Handler(event)" />

            I want to incorporate application.cfc so I can setup a login page using my current code and also get some session variables that i can pass as flashvars to my app.

            Looks like application.cfc do something that my flex app can not see the cfc.

            Are you able to use application.cfc with flex app?




            • 3. Re: flex and application.cfc
              jfb00 Level 3

              This is running me crazy. Maybe a simple question:

              Does anyone make simple application.cfc file to work with a flex app?

              Here is my simple application.cfc file


              I'm sure it should be a way. I'm using flash builder 4 (SDK 3.5 ) and CF 8.




              • 4. Re: flex and application.cfc
                Balaji Sridhar Level 2



                Follow the below mentioned steps:


                1) Place this application.cfc in the webroot of your CF8.


                2) Create a flex project with ColdFusion server type and provide the required server details in the wizard.


                3) Click on Data menu ->Connect to data/services -> Coldfusion and import your application.cfc using the Browse button.


                4) On clicking NEXT you should see your functions in your cfc.


                Please refer to:


                http://balajisridhar.wordpress.com/2009/10/08/build-a-master-detail-flex-coldfusion-applic ation-without-writing-a-line-of-code/ for details.


                Please revert back if you face any issues.





                • 5. Re: flex and application.cfc

                  I'm assuming you want to use Application.cfc so you can use session management, application variables, etc.? Yes, that is possible; I've got it working on my current project. This should get you started:


                  1. Make sure your swf file is included in a cfm file, not in the default html wrapper file Flash Builder creates when it compiles your code. That may seem obvious but it's easy to overlook.


                  2. As you already said, you do need to pass your session variables to your Flex app as flashvars. Here's some sample code to do that:


                  var flashvars = {};
                                  flashvars.email = "#session.email#";
                                  flashvars.firstName = "#session.firstName#";


                  Then inside your Flex application you can loop through this.parameters and pull out each individual value and assign it locally. Keep in mind that only happens when the swf file is loaded...if one of your session variables changes, it won't automatically appear in Flex; you'll have to pass the new value in using Remote Objects or web services.


                  As far as your Abort Exception, you'll see that when your Flex code tries to call a CFC and hits a cfabort tag (you probably see it in other circumstances as well, but the cfabort one is the one I've run into the most). Check the coldfusion-out.log for more specific errors...they should show up there.




                  ~ Amanda

                  1 person found this helpful
                  • 6. Re: flex and application.cfc
                    jfb00 Level 3

                    Thanks for you reply and help Amanda,

                    This make more sense, this is exactly what i'm doing. If I don't have the application.cfc file in my app webroot folder, all works but if I copy the application.cfc i got the error above.

                    I try to use a different index.cfm file with customs tags and from my menu option call my flex app and it works so maybe it's something relate it to load both at the time.

                    I will check my logs and come back with this tomorrow and let you know.




                    • 7. Re: flex and application.cfc
                      jfb00 Level 3

                      Hi Amanda,

                      I start over in a new flex app, copy my index.cfm file that contains the call of my swf file.

                      Flex app run fine with out the application.cfc and show data in my grid.

                      Now i copy the application.cfc file that i show in a link before, replace cfabort for cfreturn.

                      <code><cffunction name="onError" returnType="void" output="false">
                              <cfargument name="exception" required="true">
                              <cfargument name="eventname" type="string" required="true">
                              <cfdump var="#arguments#"><cfreturn> <!--- here was cfabort --->


                      Now no erros because is no cfabort, the flex app show but doesn't display any data.

                      My app web root folder is: C:\inetpub\wwwroot\MyApp\index.cfm

                      cfcs folder is: C:\inetpub\wwwroot\MyApp\cfcs\budget.cfc

                      the call in my remote object is:

                      <code><mx:RemoteObject id="my_RO" destination="ColdFusion" source="myapp.cfcs.budget">
                              <mx:method name="getBudgets" result="getBudgetsRO_Handler(event)" />

                      Without error, I don't know how to debug

                      Do I need add something in application.cfc to allow flex remoting calls?

                      Any ideas?




                      • 8. Re: flex and application.cfc
                        welcomecan Level 1

                        hi friend,



                            u didnot login.pl check first.run it.




                        • 9. Re: flex and application.cfc
                          jfb00 Level 3

                          Got this issue. i insert an empty application.cfc file into my cfcs folder and all works.