CakeSWXPHP
SWX is the native data format for Flash. It uses SWF files to store and exchange data. It is also an implementation of an RPC gateway (currently in PHP), tools (a data analyzer/debugger and a service explorer), various APIs (Flickr, Twitter, etc.), and an ActionScript library that make creating data driven Flash and Flash Lite applications a piece of cake.
I based this code on the cakeamfphp project. The SWX project by Aral Balkan also contains amfphp 1.9. Looking at the code from cakeamfphp, I was able to get SWX running and call the cake controllers as remoting services.
Download the latest version at: http://blog.aboutme.be/cakeswxphp
Just copy/past in your cake directory! Gateway locations are:
swx.php (SWX)
amf.php (AMFPHP)
json.php (JSON)
You can test your methods, using the SWX service explorer. Point your browser to the "explorer/" directory, and you will see your cake controllers + methods as remoting services!
Currently it uses an adjusted version of SWX, based on SWX 1.0. I will try to update it to future versions of SWX when I get the time...
More info about SWX at:
http://www.swxformat.org/
http://www.aralbalkan.com/ (Aral Balkan, SWX author)
Enjoy!
Download the latest version at: http://blog.aboutme.be/cakeswxphp
Just copy/past in your cake directory! Gateway locations are:
swx.php (SWX)
amf.php (AMFPHP)
json.php (JSON)
You can test your methods, using the SWX service explorer. Point your browser to the "explorer/" directory, and you will see your cake controllers + methods as remoting services!
Currently it uses an adjusted version of SWX, based on SWX 1.0. I will try to update it to future versions of SWX when I get the time...
More info about SWX at:
http://www.swxformat.org/
http://www.aralbalkan.com/ (Aral Balkan, SWX author)
Enjoy!
Comments
Comment
1 bugfix
Question
2 I dont know dude
I would really . REALLY . love some simple "drag these files into a folder and it works" type solution over the time it takes to setup the amfphp, but I'm still on the fence about all this.
Comment
3 Check your AMF path
Tom,
Make sure you are calling your path to amf correctly. I had to manually change it to http://mydomain.com/app/webroot/cake_amf_gateway.php
Comment
4 Timeout problems..
Any idea why this would be happening?
I have a sample of my problem here http://www.pbjs.com/dev/bizKids/testSWX.html
Comment
5 AMF gateway works but SWX gateway doesnt
Comment
6 cake 1.2 not supported yet
Brian, currently 1.2.X.X is not supported yet. I'm working on this, expect an update in the near future!
Comment
7 been a while and still no joy
localhost I thought was an issue, I used an IP... no luck.
/app/webroot/ still no good.
I don't know what to say. I'm super excited about SWX but this isn't working. I'm using cake version 1.1. something...maybe I have the wrong version?
Getting some strange error about the call failing:
faultCode:Client.Error.MessageSend faultString:'Send failed' faultDetail:'Channel.Connect.Failed error NetConnection.Call.BadVersion: : url: 'http://dev.local/triv-swx/app/webroot/amfphp.php'
Any clues? AMFPHP with CakePHP was easier to setup than this and from reading the SWX site, that shouldn't be the case. Also I want to use SWX and not the AMF...I already have AMFPHP with Cake working, so even using this amfphp gateway is silly to begin with.
Comment
8 Other gateway locations
Hello Tom,
The path the the amf gateway would be:
'http://dev.local/triv-swx/app/webroot/cake_amf_gateway.php''http://dev.local/triv-swx/app/webroot/amf.php'
I'm planning to change the path's to the default SWX paths in the next commit, so amf would be amf.php, swx would be swx.php (instead of cake_amf_gateway.php or cake_swx_gateway.php)Been there, done that :-)
Good luck!
Comment
9 must be doing something wrong still
maybe there's a server setting i have locally that's not jiving. who knows.
Comment
10 php log
Tom, maybe the answer is in the php error log? The location of the error might be in there...
Comment
11 replace loadController with import for cake 1.2
We ran into the same problem when we moved our cake core up to v1.2. If you turn on debugging and view your gateway pages in your browser, you should see a message about how the loadController() method is deprecated. We just changed:
loadController(null) to App::import('Controller', 'App'); in
cake_amf_gateway.php, cake_json_gateway.php, and cake_swx_gateway.php to get our AppController class importing properly.. that fixed it with cake v1.2 for us.
best,
jon
Comment
12 updated version
- gateway locations are now amf.php, swx.php and json.php
- added a branch for cake 1.2 (thanks for the input Jonathan)
Again, you can download it at http://blog.aboutme.be/cakeswxphp/
Question
13 Date Datatype with AMF
AMFPHP itself seems to support it but how do I tell that to cakeswxphp? Any idea?
Question
14 How to update swx versions
One quick question: Is updating versions of swx just a matter of downloading swxphp from Aral's website and putting it in /vendors/swx/php???
Do you want to share guidelines for updating it to the newest version of swx??
Thanks!
Bug
15 vendor deprecated warning bug
That is: I changed every ocurrence of "vendor(..." with "@vendor(..."
What is the swx version included in your code?? the comments say its 1.03 beta but it says 1.0 on the explorer.
Cheers and thanks again for great work!