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!
Comment
16 cakephp 1.2 updates
Download the latest version at http://blog.aboutme.be/cakeswxphp/
Comment
17 Sending emails
Comment
18 Sending emails
This is an issue with the current cakephp RC, which has been resolved in the svn version. Download the latest cakephp 1.2 from SVN, and it should work ok :)
Bug
19 Can't get the new version working
I am installing the new version that uses SWX 2.0. I have put all the files in their appropriate places. I am able to load up the ServicesBrowser at /amf.php and see my controllers and actions.
Problem is when I try and run a simple index action I get the following error back:
faultString = "array_merge() [http://php.net/function.array-merge]: Argument #2 is not an array"
message = "faultCode:AMFPHP_RUNTIME_ERROR faultString:'array_merge() [http://php.net/function.array-merge]: Argument #2 is not an array' faultDetail:'/opt/local/apache2/htdocs/sales_integration/cake_1.2/cake/libs/controller/controller.php on line 950'"
Any idea what is going on?
Comment
20 works here
It works fine here... Might be a problem in your php script?
Comment
21 Error
TypeError: Error #1009: Kan geen eigenschap of methode benaderen via een verwijzing naar een object dat null is.
at RawAmfService/readData()
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at flash.net::URLLoader/onComplete()
The functions show up just fine, they are all there and what not. I installed the calculator.php test to check, and it gives this error as well. What is causing it?
Comment
22 RE: Sending Emails
Add this to your controller:
function beforeFilter() {
$this->Email->startup($this);
}
Comment
23 Strings that Start with Numbers
Anybody seen this?
Comment
24 Session authentication hell
Same here. When passing across a session variable which often starts with a number, only the number gets passed along, which makes authenticating a session I nightmare - unless there's an obvious fix.Think this is just occurs with the explorer. Running everything from within my own ActionScript seems to pass variables correctly. Have to admit this does cause problems trying to test results though.