While working on a recent Flex application that uses amfphp remoting to get data back from the database, I came across the following error:
[RPC Fault faultString="Channel disconnected" faultCode="Client.Error.DeliveryInDoubt" faultDetail="Channel disconnected before an acknowledgement was received"]
After several hours of googling for the solution, couldn't find anything.
So, I just started changing the method signatures on my PHP functions and finally, I was able to get this thing to work.
The key is to change the php function to accept a parameter of "Object" type, i.e., an array of name-value pairs.
Intially my method signature looked like the following:
public function getSchools($districId, $zipCode) {
....
}
Then, I changed it to the following and every thing worked like a charm.
public function getSchools($args) {
$districId = $args['districId'];
$zipCode = $args['zipCode'];
....
}
It was tha simple.
I also had to change the Remote Object method call inside my Flex application from :
srv.getSchools(districId, zipCode);
To, the following:
var params:Object = new Object();
params.districId = String(districId);
params.zipCode = String(zipCode);
srv.getSchools(params);
I think you can fix similar errors in Zend Framework or WebOrb remoting also, although, I have tested those myself.
That was all. Happy Flexing.
Showing posts with label actionscript. Show all posts
Showing posts with label actionscript. Show all posts
Sunday, July 12, 2009
Subscribe to:
Posts (Atom)