1 person found this helpful
Great to hear that you are loving the Data Centric features!!
The PHP wizard allows the user to import php files from any location in the web-root, simply browse to that location.
Also, while generating you can choose the location where you may wish to generate the sample php file by unselecting the default location checkbox.
Regarding the gateway.php file, as you pointed out the file is generated in the output folder. Also, if you notice there is another file 'amf_config.ini' generated at the same location.
The amf_config.ini file stores the location of all the directories which contain the imported/generated service php files. Note that the location of the directories are relative to the amf_config.ini file location.
During the runtime the application calls the gateway using a url like : http://<yourserver>/<outputfolder>/gateway.php
Also, Flash Builder uses this url for introspection.
The gateway.php file cannot be moved during development. But once the development is done you can move it to any location in the web-root.
Note that the gateway url is hardcoded in the Super<Service>.as file as _serviceControl.endpoint = http://<yourserver>/<outputfolder>/gateway.php .You can move the gateway.php file to any location but will have to copy the amf_config.ini file to the same location. The amf_config.ini file will have to be modified to point to right service directories relative to its location. Also you will have to modify the <Service>.as file by changing the serviceControl.endpoint to the new location url of the gateway.php file.
Hope this helps.
Thanks for the quick reply. I could live with having the gateway.php remain inside the flex project since that one seems to be generated only once. The ini file is probably re-generated each time a new service is added (especially if it's in a new package), so that would have to be copied again each time a new service is added?
Unfortunately, there seems to be a bug in the Configure PHP Service wizard which makes it impossible for me to generate the services in any other folder than the bin-debug folder of the Flex project. Hoping someone else could confirm it before I file it?
Steps to reproduce:
1. In the Data/Services tab, click on Connect to Data/Service
2. Choose PHP
3. Enter service name, select "Generate sample PHP class"
4. Uncheck "Use default location", choose any folder that is not the bin-debug/services folder in the Flex project
5. Click Finish
I get the following error:
There was an error during service introspection.
<br /><b>Warning</b>: Zend_Loader::include_once(TestService.php) [<a href='function.Zend-Loader-include-once'>function.Zend-Loader-include-once</a>]: failed to open stream: No such file or directory in <b>/Users/jenswegar/Documents/Development/ZendFramework/library/Zend/Loader.php</b> on line <b>135</b><br /><br /><b>Warning</b>: Zend_Loader::include_once() [<a href='function.include'>function.include</a>]: Failed opening 'TestService.php' for inclusion (include_path='services/.:WebServicePHP/services/.:.:/Applications/MAMP/bin/php5/lib/php: /Users/jenswegar/Documents/Development//ZendFramework/library') in <b>/Users/jenswegar/Documents/Development/ZendFramework/library/Zend/Loader.php</b> on line <b>135</b><br />
WebServiceTestProjects.zip 621.0 K
The last part of my previous post was cut off, here's the rest:
MacBook Pro 2.33GHz (2006 model)
OS X 10.5.8
Flash Builder Beta plug-in (version 4.0, build 235740)
Note however that the PHP file has been generated in all cases. It seems it's just the introspection that fails.
So it would seem you can choose any location you want as long as it's the default location, which kind of negates it's use. I attached a set of eclipse projects in case it helps.
I found a workaround for the bug. It requires some manual editing of the amf_config.ini and some dummy service creating.
- In a clean project (i.e. one with no services added yet), go to the Data/Services view and choose "Connect to Data/Service"
- Choose PHP
- Create a Temporary service (I called mine FakeService) with the default settings and choose Finish. Let the generator do it's magic.
- In the bin-debug folder, open up the amf_config.ini file and copy the line that says amf.directories = services
- Paste the line onto the next line. Flash builder might notify you that you are editing a derived file. Just click yes here.
- Change the services part to reflect the relative path of the folder where you really want your PHP files to live. In my case it was ../../WebServicePHP/services. The path is relative to the ini file. Save the changes to the amf_config.ini file.
- Right click on an empty area in the Data/Services view, choose Connect to PHP.
- Enter the name of a service you want to create, choose generate Sample PHP class
- Uncheck the "Use default location" checkbox and browse to the location that you entered in the amf_config.ini. Create any folders you may need to create to match the path in the .ini file (e.g. In my case I had to create the WebServicePHP/services folder)
- Click Finish. The PHP file is created in the correct location and introspection still works. You can now delete the FakeService if you want to. New services can be created outside the project folder also. If you create a new package for a service, you only need to repeat steps 4-10. The FakeService only needs to be created the first time so that the gateway.php and amf_config.ini files are created.