Zend Framework

Simple Zend_Amf_Server runing on Zend_Application does not work

Details

  • Type: Bug Bug
  • Status: Resolved Resolved
  • Priority: N/A N/A
  • Resolution: Not an Issue
  • Affects Version/s: None
  • Fix Version/s: None
  • Component/s: Zend_Amf, Zend_Application
  • Labels:
    None

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:

IndexController.php
<?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

APPLICATION_PATH . '/services/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"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
		<mx:Script>
		<![CDATA[
			import mx.controls.Alert;
		]]>
	</mx:Script>
	<mx:RemoteObject id="ro" destination="zend" source="Api" showBusyCursor="true" 
					 endpoint="http://local.newproyect.com/" 
	     			 result="Alert.show(event.result.toString())">
	</mx:RemoteObject>
	<mx:Button label="Call service" click="ro.getMyText()"/>
</mx:Application>

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();
	}

Activity

Hide
Erik Wiesenthal added a comment -

It's ok, Zend_Amf works fine with Zend_Application, must be something related to my rerouter, it returns me a simple <p>End Point</p> on the amf file.

Show
Erik Wiesenthal added a comment - It's ok, Zend_Amf works fine with Zend_Application, must be something related to my rerouter, it returns me a simple <p>End Point</p> on the amf file.
Hide
Dolf Schimmel (Freeaqingme) added a comment -

Closing this issue as not an issue based on the last comment.

Show
Dolf Schimmel (Freeaqingme) added a comment - Closing this issue as not an issue based on the last comment.

People

Vote (0)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: