ZF-7187: Simple Zend_Amf_Server runing on Zend_Application does not work
Description
Triying to set a Zend_Amf end point on the Zend_Application default structure and does not work. I can make it work on brand new plain php framework independent, but not into the MVC structure using the Zend_Application
To reproduce it just:
shell > zf create project newproyect
inside the IndexController add this:
<?php
class IndexController extends Zend_Controller_Action
{
protected $_server;
public function init ()
{
// set the server up
$this->_server = new Zend_Amf_Server();
$this->_server->addDirectory(APPLICATION_PATH . '/services/');
// turn the renderer off
$this->_helper->viewRenderer->setNoRender();
}
public function postDispatch ()
{
// shut the layout off
//$this->_helper->layout->disableLayout();
// set the correct header if no error or forwarding occurred during dispatch
$this->_response->setHeader('Content-Type', 'application/x-amf', true);
}
public function indexAction ()
{
// process the request and set the response
$amfResponse = $this->_server->handle();
$this->_response->setBody($amfResponse);
//print_r($amfResponse);
}
}
(you can try with a simple echo $this->_server->handle(); inside the indexAction)
then, on the APPLICATION_PATH . '/services/' create Api.php
<?php
class Api
{
/**
* @return string
*/
public function getMyText()
{
return "hello World";
}
}
then, a simple flex3 or adobe air project:
<?xml version="1.0" encoding="utf-8"?>
www.adobe.com/2006/mxml" layout="absolute">
it returns a [RPC Fault faultString="Send failed" faultCode="Client.Error.MessageSend" faultDetail="Channel.Connect.Failed error NetConnection.Call.BadVersion: : url: 'http://local.newproyect.com/'"]
The entire system is all right: you can test it using this IndexAction:
public function indexAction ()
{
// process the request and set the response
$this->_server->listMethods();
$this->_server->getFunctions();
}
Comments
Posted by Erik Wiesenthal (erikwiesenthal) on 2009-07-03T03:17:34.000+0000
It's ok, Zend_Amf works fine with Zend_Application, must be something related to my rerouter, it returns me a simple
End Point
on the amf file.
Posted by Dolf Schimmel (Freeaqingme) (freak) on 2009-07-25T04:44:21.000+0000
Closing this issue as not an issue based on the last comment.