ActionScript 3 AMF Zend 静默失败

问题描述:

我正在尝试在纯 ActionScript 程序中连接到 Zend-PHP 服务.我已经使用 Flex 成功地使用了该服务.(但 Flex 移动应用程序过于臃肿,通常比纯 ActionScript 应用程序大 10 倍 - 这就是我尝试用纯 Actionscript 编写它的原因).

I'm trying to connect to a Zend-PHP service within a pure ActionScript program. I've managed to use the service successfully using Flex. (But Flex mobile apps are bloated, and typically 10x bigger than pure ActionScript apps - which is why I'm trying to write it in Pure Actionscript).

我正在尝试访问我下载并在以下教程中使用的 PHP/Zend 服务:-

I'm trying to access the PHP/Zend service that I downloaded, and used in the following tutorial:-

http://www.adobe.com/devnet/flex/testdrivemobile/articles/mtd_1_1.html

我要连接的 PHP 代码可从此站点下载 - 以及有关如何在 Flex 中使用它的说明.

The PHP code that I'm connecting to is available as a download from this site - as well as instructions about how to use it in Flex.

这就是我用 ActionScript 写的:-

And this is what I've written in ActionScript:-

   protected var _netConnection:NetConnection;

   protected var _responder:Responder;
   //...

   _netConnection = new NetConnection();
   _responder = new Responder(complete, errorFn);
   _netConnection.addEventListener(NetStatusEvent.NET_STATUS, errorFn);
   _netConnection.addEventListener(SecurityErrorEvent.SECURITY_ERROR, errorFn);
   _netConnection.connect("http://localhost/TestDrive/services/EmployeeService.php");
   _netConnection.call("EmployeeService.getEmployeesSummary", _responder);

   public function complete(result:Object):void {
      trace("complete");
   }

当我运行它时,它默默地失败了.没有回调.如果我更改 connect 或 call 方法的参数,errorFn 回调会起作用 -(我尝试了很多东西) - 我可以获得 NetConnection.Call.BadVersion 或 NetConnection.Call.Failed.但我从来没有设法让完整的方法被回调.

When I run this, it fails silently. No callbacks. If I change the parameters of the connect or call method, the errorFn callbacks work - (I've tried lots things) - I can get NetConnection.Call.BadVersion, or NetConnection.Call.Failed. But I've never managed to get the complete method called back.

有什么建议吗?

我花了很长时间才意识到 - 但网关 url 指向错误的 .php 文件.(但如果代码不是无声无息地失败,并产生了一些诊断信息,我可能会更快地到达那里).无论如何 - 感谢大家的帮助.

It took me a long time to realise - but the gateway url was pointing to the wrong .php file. (But had the code not failed silently, and yielded some diagnostics, I might have got there quicker). Anyway - Thanks for your help everyone.