3

I am using ZendAMF for remoting.

<?php
    error_reporting(E_ALL | E_STRICT); //error reporting, not needed

    require_once "Zend/Amf/Server.php"; //the zendAMF server
    require_once "process.php";  //our test class

    $server = new Zend_Amf_Server(); //declare the server

    $server->setClass("process"); //load our test-class to the server
    $server->setClassMap("Session", "Session");
    echo($server->handle()); // needed to start the server
?>

My Question is i have a ActionScript class Session and a PHP Class Session, but still it does not get mapped. I have some doubts... may be silly...

Should the file name of PHP class to be the same name of class name, as its not necessary but while mapping does it carry a value score.

How will you call those mapped objects inside your flex application. My approach is indicated below, but not sure whether its correct or not.

$server->setClassMap("Session", "Session"); Which is a PHP and Flex class in the above function.

Also my PHP session class is inside the include directory, should i indicate that anywhere or the ZendAMf will take care of it.

Flex Code.

var userSession:Session = new Session();
sessionHold.text = userSession.userid; 

Thanks.

Charles
  • 50,943
  • 13
  • 104
  • 142
Kevin
  • 23,174
  • 26
  • 81
  • 111
  • I've played with AMFPHP at my dayjob, and not played with the Zend AMF tool. In the Zend tool, do they have something like the "Service Browser" available with AMFPHP? That's been my best bet in terms of troubleshooting services. I've only worked the PHP side, not the Flash side though. – artlung Jun 23 '09 at 19:41
  • 1
    @artlung the service browser in AMFPHP is a stand alone Flash app that the OP should be able to easily grab from the AMFPHP download and use as a debugging tool. – dcousineau Jun 23 '09 at 21:38
  • Charles Proxy has proven invaluable to me for this sort of work. If for nothing else, it is a great sanity check. – Joel Hooks Jun 29 '09 at 00:48

2 Answers2

4

There's a few different things that you need to do. Usually it's something like adding the

[RemoteClass(alias="Session")]

to the metadata of your AS class or using one of Zend_Amf's functions like getASClassName() in your PHP object. Check out Wade Arnold's (writer of Zend_Amf) screencast re: class mapping. I'm sure he'll have your answer.

http://www.wadearnold.com/tutorials/zend/classmap/

typeoneerror
  • 55,990
  • 32
  • 132
  • 223
0

TypeOneError is correct; you're going to need

[RemoteClass(alias="Session")]
[Bindable]

at the top of your ActionScript classes.

A few other things that I've determined can cause this issue:

  • Class variables must be public and have identical names
  • The ActionScript class should not have a defined constructor
davearchie
  • 317
  • 2
  • 9
  • Oh dear. Never got this to work even I added Metatags to my as value objects. I checked with Carles, that php sends strictly typed value object to flex but mapping does not work. – Jarno Lahtinen Sep 27 '11 at 18:16