14 Replies Latest reply on Nov 24, 2009 12:39 PM by jdesko

    FB Beta 2 and gateway.php

    jdesko Level 2

      My question is where in FB Beta 2 do we set the path for gateway.php?

       

      In updating from FB Beta 1 to FB Beta 2 I see that Data/Services has been updated.  Now in Beta 2 endpoint=gateway.php is being called in a generated class file.  The generated class says that it is not intended for modification, so we must not put the path there.  Is FB Beta 2 looking for gateway.php in the root dir?

       

      Thanks in advance

        • 1. Re: FB Beta 2 and gateway.php
          mewk Level 3

          LOL -- I asked this same question in a previous post. As the post says, the gateway endpoints are configured right in the mxml file that calls the service (look in the declarations block.)

           

          One thing you can do to make life easier, from now on, is set a global constant for the gateway path (so you don't have to manually reconfigure all your files). e.g.

          <myservice:MyService id="myService" destination="MyService" source="MYService"
                endpoint="{classes.Config.GATEWAY_PATH}" showBusyCursor="true" />
          

           

          - e

          • 2. Re: FB Beta 2 and gateway.php
            jdesko Level 2

            Hello mewk;

             

            Thanks for the reply.  I saw your original post, but this looks how Beta 1 setup the data service.  After updating to FB Beta 2 and creating a new Data/Service, users, it auto generates the actionscript class -  _Super_Users.as and puts this code in

             

                   _serviceControl.operations = operations;  

            _serviceControl.convertResultHandler = TypeUtility.convertResultHandler;

                    _serviceControl.source = "users";

                    _serviceControl.endpoint = "gateway.php";

            _serviceControl.destination = "users";

             

            And the new MXML declaration was shortened to this

             

            <fx:Declarations>

            <s:CallResponder id="getUsersResult"/>

            <users:Users id="users" fault="Alert.show(event.fault.faultString + '\n' + event.fault.faultDetail)" showBusyCursor="true"/>

             

            </fx:Declarations>         

             

            John

            • 3. Re: FB Beta 2 and gateway.php
              jdesko Level 2

              Now when running debug after updating to FB 2 (FB 1 was working fine) I get errors from FB looking for gateway in the folder that the module is calling the Data/Service from.

               

              FB1 gateway.php was set in the root folder, all the modules were set to look for it there.

               

              In FB2 if I have a module in a folder (example) modules/users/users.swf that uses DCD, when debug is run I get an error:

               

              Send failed

              Channel.Connect.Failed error NetConnection.Call.Failed: HTTP: Status 404: url: 'http://localhost/bin-debug/modules/users/gateway.php'

              • 4. Re: FB Beta 2 and gateway.php
                jdesko Level 2

                Fixed - but there's got to be a better way, especially since the file that has to be modified says:

                 

                /**

                * This is a generated class and is not intended for modfication.  To customize behavior

                * of this service wrapper you may modify the generated sub-class of this class - Users.as.

                */

                 

                As stated previously in FB Beta 1 the endpoint was set in the calling app/mod Declarations.  Now in FB 2 it is being called in an auto generated service class that says do not modify.  So if we need to configure the path for gateway.php in the generated sub-class how do we set it up?

                • 5. Re: FB Beta 2 and gateway.php
                  mewk Level 3

                  jdesko,

                   

                  Let's take your example (actually I'm going to rename 'users' to 'userService'):

                  <fx:Declarations>
                       <myNS:UserService id="myUserServiceObject" />
                  </fx:Declarations>
                  
                  *** we also have the declared namespace xmlns:myNS="services.userservice.*"
                  

                  and the generated class would be:

                  package services.userservice {
                       public class UserService extends _Super_UserService { 
                       }
                  }
                  

                  and the generated superclass of this is _Super_UserService, which is fairly complex and is where you pulled the warning:

                  /**

                    * This is a generated class and is not intended for modfication.  To customize behavior

                    * of this service wrapper you may modify the generated sub-class of this class - Users.as.

                    */

                  So how do you 'customize the bahavior of the service wrapper'? By doing exactly what it says!!!!!!!!!!!!!

                   

                  The generated sub-class is UserService, but you don't modify this class -- you set the properties of the class instance, which, in this case is myUserServiceObject.

                   

                  So, back to the original post, the solution is to set the endpoint path manually:

                  <fx:Declarations>
                       <myNS:UserService id="myUserServiceObject" 
                                         endpoint="http://localhost/what/ever/you/want/here/gateway.php" />
                  </fx:Declarations>
                  

                  The reason FB 2 pulled the endpoint property from the generated service object is probably because the gateway file is often in the root folder, so why redeclare this over and over again in all your calling classes?

                   

                  Anyway, I haven't tried this with modules, but I'm pretty sure this is how you configure the path.

                   

                  - e

                  1 person found this helpful
                  • 6. Re: FB Beta 2 and gateway.php
                    jdesko Level 2

                    Hello mewk / e;

                     

                    Thanks much for the reply, your answer makes perfect sense.  I did modify the super class for the heck of it, and it worked ... but then after I removed the modified path that I put in it still worked, so I might redo my data services to get things back to original. 

                     

                    As you said in a previous post, I'm ready for the land of Nod.

                     

                    John

                    • 7. Re: FB Beta 2 and gateway.php
                      Mayank (Adobe) Adobe Employee

                      > In updating from FB Beta 1 to FB Beta 2 I see that Data/Services has been updated.  Now
                      > in Beta 2 endpoint=gateway.php is being called in a generated class file.

                       


                      Beta 1 used to generate the gateway.php URL in the instance of the service in the MXML file. In order to improve the experience of moving applications from development environment to production environment we took a two fold approach. One, the URL was moved to a common place and two, the URL was made relative.

                       


                      > The generated class says that it is not intended for modification, so we must not put the
                      > path there.  Is FB Beta 2 looking for gateway.php in the root dir?

                       

                      Going forward, after the final release, the generated class should not require modifications. Since there has been a change in code generation between Beta 1 and Beta 2, you may either make the required modifications in the generated code manually, or you may delete the code and regenerate it.

                       

                      --

                      Mayank Kumar

                      Computer Scientist, Flash Builder

                      • 8. Re: FB Beta 2 and gateway.php
                        jdesko Level 2

                        Hello Mayank;

                         

                        Thank you for the reply.

                         

                        John

                        • 9. Re: FB Beta 2 and gateway.php
                          jdesko Level 2

                          Hello Mayank;

                           

                          After updating FB Beta 2 to Nightly SDK 4.0.0.11346, I had to recreate my project, now my app is looking for gateway.php in the same folder as the module calling it.  The last SDK I was using 4.0.0.11095 everything was working fine with gateway.php in the root folder.  I have quite a few modules that use data/services so they are separated in sub-folders.  In troubleshooting this new problem I deleted all of my services and valueObjects, and then recreated them, along with a new gateway.php and amf_config.ini. - gateway.php is automatically installed in the root so is there a reason why the modules are now looking for it in their folder?

                           

                          So for example I have bin-debug/mods/users/users.swf and that is where the app is looking for gateway.php instead of bin-debug.

                           

                          Thanks in advance,

                           

                          John

                          • 10. Re: FB Beta 2 and gateway.php
                            Mayank (Adobe) Adobe Employee

                            What are your project's server and output folder settings?

                            • 11. Re: FB Beta 2 and gateway.php
                              jdesko Level 2

                              Picture 2.png

                              Above are the settings, validates good.

                               

                              *note - there should be a bug report on this already but Output folder should be bin-debug, not bin.

                               

                              And below is the error

                               

                              Picture 3.png

                              Thanks,

                              John

                              • 12. Re: FB Beta 2 and gateway.php
                                jdesko Level 2

                                In order to continue working on this project in Declarations for the service I inserted endpoint pointing to gateway.php (back to the old way - I thought this was changed(?))

                                • 13. Re: FB Beta 2 and gateway.php
                                  Mayank (Adobe) Adobe Employee

                                  Are you facing this issue with old dcd projects in beta 2 or is this issue present in new projects as well?


                                  • 14. Re: FB Beta 2 and gateway.php
                                    jdesko Level 2

                                    Hello Mayank;

                                     

                                    I am now using FB Beta 2 and SDK 12087.  The project that I have been working on I just restarted ... After backing up, uninstalled FB, deleted the project, reinstalled FB, then started with a new project.  The main app and all modules, components, skins, renderers, etc. were started anew (alot of code was copied and pasted from the old project backup files, custom skins recreated with latest skin files).  So to answer your question (sorry long answer) theoretically I don't have any old projects, I consider them new (just working on forever).

                                     

                                    With gateway.php - in each module's declaration I have to include the path to the endpoint.

                                     

                                    Example:     endpoint="http://localhost/bin-debug/gateway.php"

                                     

                                    Thanks,

                                    John