[eluser]Unknown[/eluser]
Hi,
I have been attempting to solve this issue for a while now, so apologies if you have seen my previous questions. Basically I want to implement the Zend AMF server in my codeigniter project.
Now I have managed to do this but the one problem that I have come across is handling authentication. I tried to do it in the construct of the controller I was calling but found that I was not able to do that as the response was always unencoded, so my flex app would not accept it.
so I though it might work if I wrap the gateway in a CI controller. that way I could check auth before even instantiating the servers. But I am finding that now I have done this any services I try to call cannot see any other parts of the CI installtion(error at the bottom)
This is my gateway Controller:
Code:
class Gateway extends CI_Controller
{
function __construct()
{
parent::__construct();
$this->load->library('zend');
//root_folder + application + controllers + amf + services
define('SERVICES_FOLDER', APPPATH.'controllers/amf/services/');
}
public function index()
{
$server = new Zend_Amf_Server();
$server->addDirectory(SERVICES_FOLDER);
// Add the ZamfBrowser service class so ZamfBrowser can retrieve method information.
require_once ("/Applications/MAMP/htdocs/testpr/application/libraries/Zend/browser/ZendAmfServiceBrowser.php");
$server->setClass("ZendAmfServiceBrowser");
// Set a reference to the Zend_Amf_Server object so ZendAmfServiceBrowser class can retrieve method information.
//ZendAmfServiceBrowser::$ZEND_AMF_SERVER = $server;
ZendAmfServiceBrowser::setAmfServer( $server );
echo ($server->handle());
}
}
and this is my Testservice.php file mlogin is a library that I use in the rest of my site:
Code:
class Testservice extends CI_Controller
{
function __construct()
{
parent::__construct();
}
public function login($email, $password)
{
$login = $this->mlogin->do_std_login($email, $password);
if ($login)
{
$this->errors[] = 'it worked';
return 'Logged In';
}
else
{
$this->errors[] = 'Wrong email address/password combination';
log_message('error', ' login did not work worked');
return 'not Logged in';
}
}
but when I am a call to the log in function I get the following error
Quote:[21-Sep-2011 00:40:16] PHP Fatal error: Call to a member function do_std_login() on a non-object in /Applications/MAMP/htdocs/testpr/application/controllers/amf/services/Testservice.php on line 29
[21-Sep-2011 00:40:16] PHP Stack trace:
[21-Sep-2011 00:40:16] PHP 1. {main}() /Applications/MAMP/htdocs/testpr/index.php:0
[21-Sep-2011 00:40:16] PHP 2. require_once() /Applications/MAMP/htdocs/testpr/index.php:202
[21-Sep-2011 00:40:16] PHP 3. call_user_func_array() /Applications/MAMP/htdocs/testpr/system/core/CodeIgniter.php:339
[21-Sep-2011 00:40:16] PHP 4. Gateway->index() /Applications/MAMP/htdocs/testpr/system/core/CodeIgniter.php:0
[21-Sep-2011 00:40:16] PHP 5. Zend_Amf_Server->handle() /Applications/MAMP/htdocs/testpr/application/controllers/amf/gateway.php:32
[21-Sep-2011 00:40:16] PHP 6. Zend_Amf_Server->_handle() /Applications/MAMP/htdocs/testpr/application/libraries/Zend/Amf/Server.php:657
[21-Sep-2011 00:40:16] PHP 7. Zend_Amf_Server->_dispatch() /Applications/MAMP/htdocs/testpr/application/libraries/Zend/Amf/Server.php:580
[21-Sep-2011 00:40:16] PHP 8. Zend_Server_Reflection_Method->invokeArgs() /Applications/MAMP/htdocs/testpr/application/libraries/Zend/Amf/Server.php:365
[21-Sep-2011 00:40:16] PHP 9. Zend_Server_Reflection_Function_Abstract->__call() /Applications/MAMP/htdocs/testpr/application/libraries/Zend/Server/Reflection/Function/Abstract.php:0
[21-Sep-2011 00:40:16] PHP 10. call_user_func_array() /Applications/MAMP/htdocs/testpr/application/libraries/Zend/Server/Reflection/Function/Abstract.php:380
[21-Sep-2011 00:40:16] PHP 11. Testservice->login() /Applications/MAMP/htdocs/testpr/application/controllers/amf/services/Testservice.php:0
Any help tips tricks pointers. would be gratefully received. I really want to get this to work and have spent hours on it
JaChNO