PHP Amf setClass()

$server->listMethods() returns this: Array ( [0] => getUser [1] => getPrivateData [2] => getSelectedProducts [3] => Model.selectProducts )
The last method is Model.selectProdocts.
How do I call it in Flex?

Ok,
the following simple fix is doing the job but the funny think is that its working on my other functions without casting:
private function getAllPurchasedSongs_BY_userID_result( event:ResultEvent ):void
     var resultArray:Array = new Array();
         resultArray = event.result as Array;
     if(resultArray != null)
          var sourceArray:Array = new Array();
          for( var i:int=0; i<resultArray.length; i++ )
           sourceArray[i] = resultArray[i] as PurchasedSongVO;
          this._purchasedSongsCollection.source = sourceArray;
probably that helps someone with a similar issue

Similar Messages

  • Tutorial: The Players demo – Flex, PostgreSQL, PHP/AMF working together

    Digital Showcase LLC has developed this Tutorial and Demo on database entry and update taking advantage of the extended graphics that Flex/Flash  offers, to produce a rich, compelling user interface for presenting Database usage, leveraging PHP and AMF via the Zend Framework.
    Click Here to try the live Demo.
    The 11 page Tutorial along with all the code to do this is available HERE.
    - Alan Gruskoff

    so... while no one find the probleme or even give me an answer to it, i search another solution that correspond to my knowledge and i found : As-SQL it's easy to use and while u don't need to manage a lot of data this solution will be helpfull.
    any way, even if i found another solution i still want to know the problem.

  • Flashbuilder 4 and ZEND AMF

    Hello,
    i have the following setup:
    This is my ValueObject:
    <?php
    class PurchasedSongVO
         public $txn_id;
         public $article_id;
         public $song_id;
         public $songName;
         public $artistName1;
         public $songIcon;
         public $songPreviewFileName;
         public $fullSongFileName;
    ?>
    This is my zend_amf index.php (striped it down to the non working service, the others are working fine!):
    <?php
    require_once('Zend/Amf/Server.php');
    $server = new Zend_Amf_Server();
    require_once('/orders/OrdersService.php');
    $server->setClass("OrdersService");
    $server->setClassMap( "PurchasedSongVO"                        , "PurchasedSongVO"   );
    echo($server -> handle());
    ?>
    In my OrdersService.php I have the following function:
    public function getAllPurchasedSongs_BY_userID( $user_id )
         $stmt = mysqli_prepare( $this->connection,
         "SELECT orderdetails.txn_id,`article_id`,`song_id`, `songName`, `artistName1`, `songIcon`, `songPreviewFileName`, `fullSongFileName`
                        FROM `orderdetails`,`songs`,`orders`
                        WHERE orders.user_id=?
                        AND orderdetails.txn_id=orders.txn_id
                        AND orderdetails.article_id = songs.song_id" );         
         $this->throwExceptionOnError();
         mysqli_stmt_bind_param ($stmt, 'i', $user_id );         
         $this->throwExceptionOnError();
         mysqli_stmt_execute($stmt);
         $this->throwExceptionOnError();
         $rows = array(); //result array
         $row = new PurchasedSongVO();
         while( mysqli_stmt_fetch($stmt) )
             $row = new PurchasedSongVO();//stdClass();
             mysqli_stmt_bind_result(     $stmt,
                             $row->txn_id,
                             $row->article_id,
                             $row->song_id,
                             $row->songName,
                             $row->artistName1,
                             $row->songIcon,
                             $row->songPreviewFileName,
                             $row->fullSongFileName);
                    $rows[] = $row;
         mysqli_stmt_free_result($stmt);
         mysqli_close($this->connection);
       return $rows;
    When I call this Service by 'hand' and print_r it I get for example the following:
    Array
        [0] => PurchasedSongVO Object
                [txn_id] => 44L66197L05199028
                [article_id] => 6
                [song_id] => 6
                [songName] => Let's Go A!
                [artistName1] => Ansolas & Lightrocker
                [songIcon] => defaultSongIcon_38x38.png
                [songPreviewFileName] =>
                [fullSongFileName] =>
        [1] and so on ...
    Here is how I access the service within Flex:
    os.destination ='zend';
    os.source='OrdersService';
    os.showBusyCursor=true;
    os.addEventListener( FaultEvent.FAULT, faultListener);
    os.getAllPurchasedSongs_BY_userID.addEventListener( ResultEvent.RESULT, getAllPurchasedSongs_BY_userID_result );
    public function _getAllPurchasedSongs_BY_userID( user_id:int ):void
         os.getAllPurchasedSongs_BY_userID( user_id );
         private function getAllPurchasedSongs_BY_userID_result( event:ResultEvent ):void
              var resultArray:Array = new Array();
              resultArray = event.result as Array;
              this._purchasedSongsCollection.source = resultArray;
              trace('orders:'+event.result);
    Here is my AS3 Value Object:
    package view.user.valueObjects
         [RemoteClass(alias="PurchasedSongVO")]
         [Bindable]
         public class PurchasedSongVO
              public var txn_id;//:String;
              public var article_id;
              public var song_id;
              public var songName;
              public var artistName1;
              public var songIcon;
              public var songPreviewFileName;
              public var fullSongFileName;
    Now when I call ther service the returned type of objects in the Array is just Object and not PurchasedSongVO, here the trace from above:
    orders:[object Object],[object Object],[object Object],[object Object]
    If done it this way for all other services but they all return the right type and not just object.
    Any idea what could be wrong ?

    Ok,
    the following simple fix is doing the job but the funny think is that its working on my other functions without casting:
    private function getAllPurchasedSongs_BY_userID_result( event:ResultEvent ):void
         var resultArray:Array = new Array();
             resultArray = event.result as Array;
         if(resultArray != null)
              var sourceArray:Array = new Array();
              for( var i:int=0; i<resultArray.length; i++ )
               sourceArray[i] = resultArray[i] as PurchasedSongVO;
              this._purchasedSongsCollection.source = sourceArray;
    probably that helps someone with a similar issue

  • Zend AMF Authentication & Authorization

    How do I secure my PHP services created with 'Connect To PHP' wizard?
    The web is full of tutorials on connecting to PHP but I found nothing on securing the services.
    The 'Connect to PHP' wizard generates a gateway.php which doesn't do authorization.
    Do I have to replace this endpoint with my own? Why doesn't Adobe have tutorials on this?
    maybe PHP apps are not meant to be safe?

    I've been struggling with it, and figured it all out - so, perhaps it could help others.
    The authentication is called on the server only if credentials supplied from the client (via the remote procedure call headers). This snippet illustrates the setup of custom auth (these are the last 6 lines of gateway.php script):
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    // Handle request
    $auth = new My_Amf_Auth(); // authentication
    $server->setAuth($auth);
    $acl = new Zend_Acl(); // authorization
    $server->setAcl($acl);
    echo $server->handle();
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Now, your custom auth should extend Zend_Amf_Auth_Abstract. Since I want to authenticate users from a database, I bring the Zend_Auth_Adapter_DbTable to play. But since I cannot extend both Zend_Amf_Auth_Abstract and Zend_Auth_Adapter_DbTable, I use a composition:
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    <?php
    require_once ('Zend/Amf/Auth/Abstract.php');
    * AMF auth class by Danko Kozar, dankokozar.com
    * @author dkozar
    class My_Amf_Auth extends Zend_Amf_Auth_Abstract {
        function __construct() {
        public function authenticate() {
            $adapter = My_Db_Adapter::getInstance();            
            $adapter->setIdentity($this->_username);
            $adapter->setCredential($this->_password);
            // the adapter call
            // you can wrap it into try.. catch and process DB connection errors
            $result = Zend_Auth::getInstance()->authenticate($adapter);
            return $result;
    ?>
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Here's the adapter class:
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    <?php
    * DB table adapter auth class for AMF by Danko Kozar, dankokozar.com
    * @author dkozar
    * Singleton
    class My_Db_Adapter extends Zend_Auth_Adapter_DbTable {
        protected static $_instance = null;
         * private!
         * @param My_Db_Adapter $adapter
        public function __construct(Zend_Db_Adapter_Abstract $adapter = null) {
            if (!$adapter)
                $adapter = new Zend_Db_Adapter_Mysqli(
                    array(
                        'dbname' => 'test',
                        'username' => 'root',
                        'password' => '')
            parent::__construct($adapter);
            $this
                ->setTableName('users')
                ->setIdentityColumn('username')
                ->setCredentialColumn('password')
            // just for testing
    //        $this
    //            ->setIdentity('username')
    //            ->setCredential('password')
         * @return  My_Db_Adapter
        public static function getInstance()
            if (null === self::$_instance) {
                self::$_instance = new self();
            return self::$_instance;
        public function authenticate() {
            $_authResult = parent::authenticate();
            // NOTE: The point is that $result->_identity is an OBJECT (of type stdClass), NOT string
            // with Zend_Auth_Adapter_DbTable it is internally accomplished by calling its getResultRowObject() method
            // It constructs the stdClass with properties named after table attributes
    //        $user = new stdClass();
    //        $user->role = "administrator";
    //        $user->username = $_authResult->getIdentity();
            $identity = $this->getResultRowObject();
            $result = new Zend_Auth_Result($_authResult->getCode(), $identity);
            return $result;
    ?>
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    On the Flex side I have an auto-generated class (MyService) which extends another auto-generated class (_Super_MyService).
    The point is that the outer one is auto-generated only once (initially), and you can modify it, without worrying to be overwritten on service regeneration.
    There's a protected property _serviceControl (which is of type RemoteObject) which could be tweaked if needed.
    I'm tweaking it by of setting the endpoint (with string read from a client side config in preInitializeService() method). Plus, I'm adding 2 more methods, which expose setCredentials and setRemoteCredentials methods of _serviceControl, so I can acces it from my code.
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    package services.myservice
        public class MyService extends _Super_MyService
             * Override super.init() to provide any initialization customization if needed.
            protected override function preInitializeService():void
                super.preInitializeService();
                // Initialization customization goes here
                _serviceControl.endpoint = "http://localhost/myapp/gateway.php";
            public function setCredentials(username:String, password:String, charset:String=null):void
                _serviceControl.setCredentials(username, password, charset);
            public function setRemoteCredentials(username:String, password:String, charset:String=null):void
                _serviceControl.setRemoteCredentials(username, password, charset);
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
    So, before calling MyService methods, I'm setting the credentials with setCredentials() method and this runs the authentication on the PHP side:
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    private var service:MyService;
    service = new MyService(); // ServiceLocator.getInstance().getHTTPService("presetLoader");
    service.setCredentials("user1", "pass1");
    var token:AsyncToken = service.getData();
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
    The authentication via Zend_Amf_Server is, by the way, OPTIONAL! Meaning, with no credentials supplied, Zend_Amf_Server will NOT RUN IT. Thus you should rely on Zend_Acl (e.g. roles) to so your permissions and security! 
    Finally, here's the MySQL DB table I've been using for authentication: 
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
    -- Table structure for table `users`
    CREATE TABLE IF NOT EXISTS `users` (
      `id` int(11) NOT NULL AUTO_INCREMENT,
      `username` varchar(50) NOT NULL,
      `password` varchar(32) DEFAULT NULL,
      `role` varchar(45) DEFAULT NULL,
      `firstname` varchar(50) DEFAULT NULL,
      `lastname` varchar(50) DEFAULT NULL,
      `email` varchar(255) DEFAULT NULL,
      PRIMARY KEY (`id`),
      UNIQUE KEY `username` (`username`),
      UNIQUE KEY `id_UNIQUE` (`id`)
    ) ENGINE=InnoDB  DEFAULT CHARSET=utf8 AUTO_INCREMENT=2 ; 
    -- Dumping data for table `users`
    INSERT INTO `users` (`id`, `username`, `password`, `role`, `firstname`, `lastname`, `email`) VALUES
    (1, 'user1', 'pass1', 'administrator', 'Danko', 'Kozar', NULL); 
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Cheers!
    Danko

  • Unable to connect to the server to pull data from mysql

    Hello,
    I am novice working with Flash Builder 4 and I just created a test application which runs well in my computer pulling data from Mysql using PHP and populating a datagrid. But when I transfered it to the my hosting provider failed. I have been doing some modifications to the gateway.php and amf.config.ini to solve some of the issues. Now the application try to run but doesn't populate the data in the datagrid. I included a tracking point in my data service file to read the connections variables, but they come up in blank. I highly appreciate any help. Here are my gateway.php, amf.config.ini and the data service.
    gateway.php
    <?php
    ini_set("display_errors", 1);
    $dir = dirname(__FILE__);
    $webroot = $_SERVER['DOCUMENT_ROOT'];
    $configfile = "$dir/amf_config.ini";
    $fp = fopen("tracking.txt", "a");
    fwrite($fp, "1-config file " . $configfile . "\r\n");
    //default zend install directory
    $zenddir = $webroot. '/ZendFramework/library';
    //-$zenddir = $webroot;
    fwrite($fp, "2-default zendir" . $zenddir . "\r\n");
    //Load ini file and locate zend directory
    if(file_exists($configfile)) {
         $arr=parse_ini_file($configfile,true);
         if(isset($arr['zend']['webroot'])){
              $webroot = $arr['zend']['webroot'];
              $zenddir = $webroot. '/ZendFramework/library';
         if(isset($arr['zend']['zend_path'])){
              $zenddir = $arr['zend']['zend_path'];
    fwrite($fp, "3-after zendir" . $zenddir . "\r\n");
    // Setup include path
    //add zend directory to include path
    set_include_path(get_include_path().PATH_SEPARATOR.$zenddir);
    // Initialize Zend Framework loader
    require_once 'Zend/Loader/Autoloader.php';
    //-require_once 'Autoloader.php';
    Zend_Loader_Autoloader::getInstance();
    // Load configuration
    $default_config = new Zend_Config(array("production" => false), true);
    $default_config->merge(new Zend_Config_Ini($configfile, 'zendamf'));
    $default_config->setReadOnly();
    $amf = $default_config->amf;
    fwrite($fp, "4- configfile" . $dafault_config["production"] . "\r\n");
    // Store configuration in the registry
    Zend_Registry::set("amf-config", $amf);
    // Initialize AMF Server
    $server = new Zend_Amf_Server();
    $server->setProduction($amf->production);
    if(isset($amf->directories)) {
         $dirs = $amf->directories->toArray();
         foreach($dirs as $dir) {
             // get the first character of the path.
             // If it does not start with slash then it implies that the path is relative to webroot. Else it will be treated as absolute path
             $length = strlen($dir);
             $firstChar = $dir;
             if($length >= 1)
                  $firstChar = $dir[0];
             if($firstChar != "/"){
                  // if the directory is ./ path then we add the webroot only.
                  if($dir == "./"){                  
                       $server->addDirectory($webroot);
                  }else{
                       $tempPath = $webroot . "/" . $dir;
                        $server->addDirectory($tempPath);
              }else{
                      $server->addDirectory($dir);             
    fwrite($fp, "5-temp path" . $tempPath . "=>" . "\r\n");
    fwrite($fp, "******************************************" . "\r\n");
    // Initialize introspector for non-production
    if(!$amf->production) {
         $server->setClass('Zend_Amf_Adobe_Introspector', '', array("config" => $default_config, "server" => $server));
            $server->setClass('Zend_Amf_Adobe_DbInspector', '', array("config" => $default_config, "server" => $server));
    // Handle request
    echo $server->handle();
    ?>
    amf.config.ini
    [zend]
    ;set the absolute location path of webroot directory, example:
    ;Windows: C:\apache\www
    ;MAC/UNIX: /user/apache/www
    ;-webroot =c:/wamp/www/
    webroot = /home/frutiexp/public_html
    ;set the absolute location path of zend installation directory, example:
    ;Windows: C:\apache\PHPFrameworks\ZendFramework
    ;MAC/UNIX: /user/apache/PHPFrameworks/ZendFramework
    ;zend_path = /home/frutiexp/public_html/ZendFramework
    [zendamf]
    amf.production = true
    amf.directories[]=fb41/services
    ;amf.directories[]=./
    CoursesService.php
    <?php
    *  README for sample service
    *  This generated sample service contains functions that illustrate typical service operations.
    *  Use these functions as a starting point for creating your own service implementation. Modify the
    *  function signatures, references to the database, and implementation according to your needs.
    *  Delete the functions that you do not use.
    *  Save your changes and return to Flash Builder. In Flash Builder Data/Services View, refresh
    *  the service. Then drag service operations onto user interface components in Design View. For
    *  example, drag the getAllItems() operation onto a DataGrid.
    *  This code is for prototyping only.
    *  Authenticate the user prior to allowing them to call these methods. You can find more
    *  information at <link>
    class CoursesService {
         var $username = "myusername";
         var $password = "mypassword"
         var $server = "localhost";
         var $port = "3306";
         var $databasename = "frutiexp_trainsur";
         var $tablename = "courses";
         var $connection;
          * The constructor initializes the connection to database. Everytime a request is
          * received by Zend AMF, an instance of the service class is created and then the
          * requested method is invoked.
         public function __construct() {
                $this->connection = mysqli_connect(
                                              $this->server, 
                                              $this->username, 
                                              $this->password,
                                              $this->databasename,
                                              $this->port
    $fp = fopen("./tracking.txt", "a");
    fwrite($fp, "1-service".  $databasename . " " . $username . "\r\n");
    fclose($fp);
              $this->throwExceptionOnError($this->connection);
          * Returns all the rows from the table.
          * Add authroization or any logical checks for secure access to your data
          * @return array
         public function getAllCourses() {
              $stmt = mysqli_prepare($this->connection, "SELECT * FROM $this->tablename");         
              $this->throwExceptionOnError();
              mysqli_stmt_execute($stmt);
              $this->throwExceptionOnError();
              $rows = array();
              mysqli_stmt_bind_result($stmt, $row->cou_id, $row->cou_title, $row->cou_overview, $row->cou_objectives);
             while (mysqli_stmt_fetch($stmt)) {
               $rows[] = $row;
               $row = new stdClass();
               mysqli_stmt_bind_result($stmt, $row->cou_id, $row->cou_title, $row->cou_overview, $row->cou_objectives);
              mysqli_stmt_free_result($stmt);
             mysqli_close($this->connection);
             return $rows;
          * Returns the item corresponding to the value specified for the primary key.
          * Add authroization or any logical checks for secure access to your data
          * @return stdClass

    Hello Jdesko,
    Thank you for you prompt response. Yes, I have changed the connections variables in my dataservice ( I didn't post real values). You are right, after all I didn't make changes on the gateway.php except to add some tracking points. The one that I changed is the amf.config,ini. The application runs without any error exceptions, but don't populate the datagrid. According with the tracing is stoping just when establishing the connection to the database. Please let me know if you have any other clue. thanks

  • Zend + FB + MySQL problem

    Hi all,
    I am trying to teach myself the Zend connection to my database with a simple FB4 example, but I can't get it to work at all. It may be something simple, but I can't for the life of me, see it.
    This is my MXML code:
    <?xml version="1.0" encoding="utf-8"?>
    <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
                      xmlns:s="library://ns.adobe.com/flex/spark"
                      xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600">
         <fx:Declarations>
              <!-- Place non-visual elements (e.g., services, value objects) here -->
              <s:ChannelSet id="zend_amf_channel_set">
                   <s:channels>
                        <s:AMFChannel uri="http://www.localhost/gateway.php"/>
                   </s:channels>
              </s:ChannelSet>
              <s:RemoteObject id="family_VO" destination="zend-amf" source="family"
                                  channelSet="{zend_amf_channel_set}"
                                  showBusyCursor="true"
                                  fault="membersError(event)">
                   <s:method name="getAllMembers" result="getAllMembersResult(event)"/>
              </s:RemoteObject>
         </fx:Declarations>
         <fx:Script>
              <![CDATA[
                   import mx.controls.Alert;
                   import mx.events.FlexEvent;
                   import mx.rpc.events.FaultEvent;
                   import mx.rpc.events.ResultEvent;
                   //private const GATEWAY_URL:String = "c:\wamp\www\WilliamsFamily\gateway.php";
                   private var memberData:MemberData;
                   [Bindable]
                   private var lang_title:String = "My Attempt To Figure This Stuff Out!";
                   protected function getAllMembers():void
                        family_VO.getAllMembers;
                   protected function clearDataGrid():void
                        member_dg.dataProvider = {};     
                   protected function getAllMembersResult(e:ResultEvent):void
                        member_dg.dataProvider = e.result;
                   protected function membersError(e:FaultEvent):void
                        Alert.show(e.toString());
              ]]>
         </fx:Script>
         <s:VGroup   width="100%" horizontalAlign="center" paddingTop="25">
              <s:Label text ="{lang_title}" fontSize="20"/>
              <mx:DataGrid id="member_dg" height="100">
                   <mx:columns>
                        <mx:DataGridColumn headerText="ID" dataField="id" width="100"/>
                        <mx:DataGridColumn headerText="First Name" dataField="fname"/>
                        <mx:DataGridColumn headerText="Last Name" dataField="lname"/>
                        <mx:DataGridColumn headerText="Age" dataField="age"/>
                        <mx:DataGridColumn headerText="Gender" dataField="gender" width="200"/>
                   </mx:columns>
              </mx:DataGrid>
              <s:HGroup>
                   <s:Button label="Get Family Members" click="{getAllMembers();}"/>
                   <s:Button label="Clear" click="{clearDataGrid();}"/>
              </s:HGroup>
         </s:VGroup>
    </s:Application>
    The family.php
    <?php
    require_once 'MemberData.php';
    class Family
         public function __construct()
              mysql_connect("localhost", "root", "root");
              mysql_select_db("williamsfamily");
         public function getAllMembers()
              //Array of family members
              $members = array();
              //Select all fields from db table
              $result = mysql_query("SELECT * FROM family");
              //if successfuly, go through results
              while ($row = mysql_fetch_assoc($result))
                   //create family member value object and populate with values
                   $member = new MemberData();
                   $member->id = $row["id"];
                   $member->fname = $row["fname"];
                   $member->lname = $row["lname"];
                   $member->age = $row["age"];
                   $member->gender = $row["gender"];
                   array_push($members, $member);
         //return the array of family members to flex
         return $members;
    ?>
    MemberData.php
    <?php
    class MemberData
         public $id;
         public $fname;
         public $lname;
         public $age;
         public $gender;
    ?>
    gateway.php
    <?php
    $debug = true;
    if ($debug)
         error_reporting(E_ALL|E_STRICT);
         ini_set("display_errors", "on");
    else
         ini_set("display_errors", "off");
    require_once "Zend/Amf/Server.php";
    $server = new Zend_Amf_Server();
    require_once "family.php";
    $server->setClass("Family");
    $server->setClassMap("MemberData", "MemberData");
    echo($server->handle());
    ?>
    I was following a tutorial I found that seemed to explain the Zend+WAMP setup fairly well. I changed the php.ini include path to point to teh Zend/Library.
    It seems like I am not connecting to the database at all. Anyone see problems with the code?
    Thanks a million for the help!!

    Solved my own issue. The PDO wrapper is case sensitive when it comes to dealing with Oracle. Thus:
    class Equipment extends Zend_Db_Table
    protected $_name = 'EQUIPMENT;
    protected $_primary = 'ID';
    protected $_schema = 'ZZ';
    protected $_sequence = true;
    Nevertheless, I woul recommend staying away from the PDO wrapper and use standard oci functions.

  • Custom properties panel

    Is it possible to create or modify a properties panel in DW
    MX 2004? I
    use PHP and my form fields all have their value set by a
    function, and
    their class set the same way (the CSS for a field with an
    error is
    different than one w/o any errors). So a text input looks
    like:
    <input name="First_Name" type="text" class="<?php echo
    setClass('First_Name') ?>" value="<?php echo
    getVal('First_Name') ?>"
    What I would like to do is modify the templates for edit
    dialog so that
    I don't have to do so much cut-n-paste. Ideally it would
    automatically
    enter the <?php echo getVal('') ?> into the value
    attribute, and read
    the value of the name attribute into the getVal() call.
    Bill

    only if you made them components could you assign custom properties using a panel.

  • Flash Builder Beta 2 output folder issues

    I have a project that was created in FB Beta were everything was working fine; just updated to FB Beta 2 (uninstalled FB Beta).  With the existing project from FB Beta, I had to completely reset it up in FB Beta 2 (Data/Services, gateway.php, amf-config.ini, etc.).  The problem is in the Project's properties output folder FB keeps setting it to -> bin; in setting up the project I specified bin-debug, in FB Beta I was using bin-debug, if I click on restore defaults it sets bin-debug, but when I go back to properties it's back to bin.  I've never used bin in the past.  I've also had where FB creates a bin folder to put the output in (this is inconsistent) and when it does my .php files that are in the services folder are deleted/removed.  Pictures to describe are below.
    I select Restore Defaults / or manually type in bin-debug/ also this is how the project was created
    I go back to the projects properties and get this

    Thanks for the reply David.
    when you change the folder back to bin-debug does the package explorer update to indicate the change has been made ?
    Every time that I go into the projects preference under the output folder it always shows bin, but it inconsistently removes bin-debug and creates a bin folder and removes bin-debug.  Every time that I'm in properties I always make sure that I save with bin-debug set, so package explorer does show bin-debug. 
    Also have you tried to manually name the output path  outside of Flashbuilder then edit the actionscriptproperties file to to new path.
    I've always used bin-debug so I didn't have to manually name;  actionscriptproperties does show bin-debug also. 
    I don't know if you wanted me to try a new folder to see what happens?  I haven't,  I'd rather figure out why bin is always set.
    Thanks for the help and the reply,
    John

  • Flex + amf php server deployment problem

    Hi all,
    After almost a month of research on this problem. I was able to remove all my errors on production but still not able to retrieve data.
    Please help......
    Here is the scenerio details :
    I created a form which will take input from user and store those values in database.you can visit it here on web server :
    http://www.accurateoptics.in/
    I followed all the steps mentioned on adobe's test drive tutorial. It works fine on my local machine with WAMP installation. But the moment,
    I upload it...Bang!!!! there comes the error ::::
    Channel.Connect.Failed error NetConnection.Call.BadVersion: : url: http://www.accurateoptics.in/gateway.php
    I googled again, read a lot of articles and figured out that some changes are required in my gateway.php and amf-config.ini files for production environment.
    Did the necessary changes and uploaded again.Bang!!!!!!! new error comes:::::::
    Channel disconnected before an acknowledgement was received.
    to solve this, again googled a lot and figured out that i need to upload zend framework files so, did that and setting up the path for zend in amf-config.ini.
    uploaded again.
    Now, i am stuck at this point where no error is thrown only an alert box comes with a ok button. also, data is not retrieved from server.
    I dont know what error i am making.here is my amf-config.ini file:::::::::::::
    [zend]
    ;set the absolute location path of webroot directory, example:
    ;Windows: C:\apache\www
    ;MAC/UNIX: /user/apache/www
    webroot =http://www.accurateoptics.in
    ;set the absolute location path of zend installation directory, example:
    ;Windows: C:\apache\PHPFrameworks\ZendFramework\library
    ;MAC/UNIX: /user/apache/PHPFrameworks/ZendFramework/library
    ;zend_path =
    zend_path = ./ZendFramework/library
    [zendamf]
    amf.production = true
    amf.directories[]= http://www.accurateoptics.in/services
    here is my gatway.php file :::::::::::::;
    <?php
    ini_set("display_errors", 1);
    //$dir = dirname(__FILE__);
    $dir = '.';
    $webroot = $_SERVER['DOCUMENT_ROOT'];
    //$configfile = "$dir/amf_config.ini";
    $configfile = "amf_config.ini";
    //default zend install directory
    $zenddir = $webroot. '/ZendFramework/library';
    //Load ini file and locate zend directory
    if(file_exists($configfile)) {
    $arr=parse_ini_file($configfile,true);
    if(isset($arr['zend']['webroot'])){
    $webroot = $arr['zend']['webroot'];
    $zenddir = $webroot. '/ZendFramework/library';
    if(isset($arr['zend']['zend_path'])){
    $zenddir = $arr['zend']['zend_path'];
    // Setup include path
    //add zend directory to include path
    set_include_path(get_include_path().PATH_SEPARATOR.$zenddir);
    // Initialize Zend Framework loader
    require_once 'Zend/Loader/Autoloader.php';
    Zend_Loader_Autoloader::getInstance();
    // Load configuration
    $default_config = new Zend_Config(array("production" => false), true);
    $default_config->merge(new Zend_Config_Ini($configfile, 'zendamf'));
    $default_config->setReadOnly();
    $amf = $default_config->amf;
    // Store configuration in the registry
    Zend_Registry::set("amf-config", $amf);
    // Initialize AMF Server
    $server = new Zend_Amf_Server();
    $server->setProduction($amf->production);
    if(isset($amf->directories)) {
    $dirs = $amf->directories->toArray();
    foreach($dirs as $dir) {
    // get the first character of the path.
    // If it does not start with slash then it implies that the path is relative to webroot. Else it will be treated as absolute path
    $length = strlen($dir);
    $firstChar = $dir;
    if($length >= 1)
    $firstChar = $dir[0];
    if($firstChar != "/"){
    // if the directory is ./ path then we add the webroot only.
    if($dir == "./"){
    $server->addDirectory($webroot);
    }else{
    $tempPath = $webroot . "/" . $dir;
    $server->addDirectory($tempPath);
    }else{
    $server->addDirectory($dir);
    // Initialize introspector for non-production
    if(!$amf->production) {
    $server->setClass('Zend_Amf_Adobe_Introspector', '', array("config" => $default_config, "server" => $server));
    $server->setClass('Zend_Amf_Adobe_DbInspector', '', array("config" => $default_config, "server" => $server));
    // Handle request
    echo $server->handle();
    ?>
    Looking for some help!! Thanks in advance..............

    Please elaborate.
    I tried visitng http://www.accurateoptics.in/endpoint.php
    but "page not found " returned
    However, i also tried visitng "http://www.accurateoptics.in/gateway.php"
    it shows me this echo result on page " Zend Amf Endpoint ".
    so, if i m reaching to this place that means my gateway.php and amf-config.ini is fine.
    the problem is somewhere else in any of these three files.

  • Populating a Combobox using Remoting with AMF and PHP

    Hello all
    I am using Zend framework and Flex 3.4 to create a webapp. I am stuck at how to populate a combobox dynamically using the service I created in PHP.
    In some of examples I saw that result of database query was being converted into XML and then sent to Flex. This seems a little too time-consuming if I have to do it every time. I saw some examples in Adobe Docs about Remoting with AMF and PHP. That seems like a better approach although how it would be applicable here is beyond me right now.
    Can somebody guide me in correct direction?
    Thanks and Regards
    Shivik

    Try this: http://code.google.com/p/as3flexdb/ is very easy to use and it
    will help.
    All you need to populate a combo is:
    <mx:ComboBox dataProvider="{query.Records} /

  • Amf and CodeIgniter (FB 4 PHP)

    So I downloaded this sample http://www.adobe.com/devnet/flex/testdrive.html
    And apparently the code is so out of date in the php gateway side that nothing works.  I download zend framework and spent hours trying to get it working and after so much work, still didn't work, alot of errors, i fixed some errors and problems, and still had some more errors and issues to the point that it just didn't work.
    So i downloaded the amfphp (http://www.silexlabs.org/amfphp/) library with CodeIgniter,  after some quick fixes, it workis like a charm. Everything works, without much hasle it work great. Got the test drive sample fully working rather quickly.
    So I am trying to create more data connections.
    The problem is that FB is programed/hardcoded (in data/connect to php), to only work with zendframework Amf, and has all kinds of issues, and won't even try to detect anything that is not zendframework or the Zend_Amf. Why such limitations? This makes the whole purpose of the whole thing useless. codeIgniter works just fine without all the issues and compatiblity issues, and not to mention testing it with the latest ZF version, so incompatible!. So AMF works great CI but yet I can't use it just because is not zend_amf!. Now spend another week to even try to get ZF AMF working.. so much for test drive in an hour!   do developer a favor. Get serious about supporting more frameworks or general AMF connection and not just lock it up to ZF, without any other options!..

    Forget this question, I am going to use FB 4.6

  • ZEND/Flex - amf-config.php help!!

    Have some odd behavior taking place when promoting release builds to my production server.
    I have two projects one works - one does not. Both the same settings as far as I can tell.
    Using the amf-config.ini file - this test works
    [zend]
    ;set the absolute location path of webroot directory, example:
    ;Windows: C:\apache\www
    ;MAC/UNIX: /user/apache/www
    ;webroot =C:/Program Files/Zend/Apache2/htdocs
    webroot = ../../
    ;set the absolute location path of zend installation directory, example:
    ;Windows: C:\apache\PHPFrameworks\ZendFramework
    ;MAC/UNIX: /user/apache/PHPFrameworks/ZendFramework
    ;zend_path =
    [zendamf]
    amf.production = false
    amf.directories[]=xyz/release/services
    The next release uses the same gateway and amf-config files - and I get this error.
    Class "XYZservice" does not exist: Plugin by name 'XYZservice' was not found in the registry; used paths: : /xyz/release/services/
    #0 /var/www/vhosts/xyz.com/httpdocs/ZendFramework/library/Zend/Amf/Server.php(550): Zend_Amf_Server->_dispatch('secure', Array, 'XYZservice')
    #1 /var/www/vhosts/xyz.com/httpdocs/ZendFramework/library/Zend/Amf/Server.php(626): Zend_Amf_Server->_handle(Object(Zend_Amf_Request_Http))
    #2 /var/www/vhosts/xyz.com/httpdocs/xyz/release/gateway.php(69): Zend_Amf_Server->handle()
    #3 {main}
    Have tried many variations - but still no joy. Why does ../../ work and not the direct path? - by the look of it, those directory's are fine.
    As I understand it - no matter what set-up you build on (local Windows) and promote to a hosted production server (US, mediatemple) - as long as you configure the amf-config.ini file all should be good. Is this the case? Am I missing something when I do a release build.
    Am I better of specifying the "endpoint" in all my service calls in my declarations (mxml code)?
    Been going round in circles with this for several months now. Getting to the point where the only way I can deploy is Windows. DO NOT want to go down that road.
    Help is much appreciated.
    rgds
    martin

    6 Hours of headache later I solved this problem!
    So in my case the amf_config.ini was set up correctly with webroot=/fullpath/to/url/root and amf.service=foldername (php in my case)
    on my local machine the services file is product.php and everything is groovy and working
    I uploaded everything exactly as it is on my machine and got the error you did.
    I simply cp product.php to Product.php and it worked
    For somereason the zend framework is looking for a file that starts with a capital letter!!!! even though it works fine on my machine and was referenced as product.php! Are you kidding me? What a headache.
    Joel

  • Completely different AMF request packets for same remote service call from Flex to PHP using ZendAMF

    I was trying to debug why one of the remote-services in our Flex application was failing randomly. What I found was interesting. Completely different AMF request packets were sent for same remote service call from Flex to PHP.
    When the service call succeeds the AMF request packet looks like the following:
    POST /video/flex/bin-debug/gateway.php HTTP/1.1
    Host: localhost
    User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.15) Gecko/20110303 Firefox/3.6.15
    Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
    Accept-Language: en-us,en;q=0.5
    Accept-Encoding: gzip,deflate
    Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
    Keep-Alive: 115
    Cookie: PHPSESSID=j6u30i8uu6c3cvp8f4kipcpf05
    Referer: http://localhost/video/flex/bin-debug/main.swf/[[DYNAMIC]]/5
    Content-type: application/x-amf
    C    ontent-length: 305
    Flex Message (flex.messaging.messages.RemotingMessage)     operation = getMemberFromEvent    clientId = 2F997CD0-7D08-8D09-1A9B-0000422676C8    destination = MembereventService    messageId = B46AB58D-2241-83F0-41E4-9FE745565492    timestamp = 0    timeToLive = 0    body =     [      280    ]    hdr(DSId) = nil
    And when the service fails the AMF request packet looks like this:
    ServiceRequest: getMemberFromEvent; RemoteService; getMemberFromEvent
    (mx.messaging.messages::RemotingMessage)#0
      body = (Array)#1
        [0] 250
      clientId = "1AA4FAAB-AEA5-8109-4B0D-000002B3A9A1"
      destination = "MembereventService"
      headers = (Object)#2
        DSEndpoint = (null)
        DSId = "nil"
      messageId = "2F92E6C0-FE92-A09B-B150-9FE2F28D9738"
      operation = "getMemberFromEvent"
      source = "MembereventService"
      timestamp = 0
      timeToLive = 0
    Also, following is the error message on Flex when the service fails:
    {Fault code=Channel.Call.Failed, Fault string=error, Fault detail=NetConnection.Call.Failed: HTTP: Failed, Destination=MembereventService}
    We are using Swiz as the micro-architecture for Flex development and Zend AMF for remoting between Flex and PHP.
    Any ideas what is wrong here, what is causing Flex to send different request packets for the same service & what I can do to fix it?

    Hi, I know that your post is almost 5 years ago, but have you found the solution to this issue?
    Thanks.

  • Adobe Flex + PHP (Using Data Transfer Object pattern in amf)

    hello
    i'am using amf to connect my flex application to the php back end,but i want to use DTO(DataTransferObject), i haven't enough info about this pattern.
    can you introduce me a reference or have you any suggestion?
    thanks for your attention
    Uniqe_max (amin shahnazary)

    here is another way of doing it
    http://www.youtube.com/watch?v=1n1uHQAP18Q
    http://www.youtube.com/watch?v=fQsCBk9tvkQ

  • Flex and Zend amf deployment resolved with proper solution

    Hi All,
    Although, I personally do not like using Zend for these issues itself. However, I faced this issue first time with flex 4.0 version when everyone used to run into
    channel disconnected error. you can find the link for that post here:
    http://forums.adobe.com/message/3366991.
    Now, with flash builder 4.6, things have changed slightly and so the deployment process. So, here are the right set of steps to be followed :
    1. after developing your flash project, export the release build(I assume if you are a flex user, you should know these steps already)
    2. Now, check your release folder, you must have got some files with amfconfig.ini and gateway.php and just one folder named history.
    3. copy all these files into a new folder say "My Release Build".
    4. Now, step 1 is get Zend framework in place, to achieve that:
    there are different ways. some will say : "make sure zend must already installed on your production server." that is an alternative but most likely,  the easier way to do this is : search your www(root folder on localhost),you will find a folder with name ZendFramework. Copy this folder to "My Release Build"
    5. Now, the services that you have used in your flex project, go to debug folder of your project which should be in your www(root folder on localhost) with name "yourprojectname-debug". copy services folder from this debug folder to "My Release Build"
    6. Now, open your amfconfig.ini from "My Release Build" and edit and make it look like following:
    [zend]
    webroot = http://www.yourwebsite.com
    ;you can edit above webroot to match the root folder of your website or use . to make it point to root.
    zend_path = ./ZendFramework/library
    [zendamf]
    amf.production = true
    amf.directories[]= services
    thats it. your amf config is fine.
    7. edit gateway.php:
    Now, remove everything from gateway.php and copy this as it is there:
    <?php
    ini_set("display_errors", 1);
    $dir = '.';
    $webroot = $_SERVER['DOCUMENT_ROOT'];
    $configfile = "amf_config.ini";
    //default zend install directory
    $zenddir = $webroot. '/ZendFramework/library';
    //Load ini file and locate zend directory
    if(file_exists($configfile)) {
        $arr=parse_ini_file($configfile,true);
        if(isset($arr['zend']['webroot'])){
            $webroot = $arr['zend']['webroot'];
            $zenddir = $webroot. '/ZendFramework/library';
        if(isset($arr['zend']['zend_path'])){
            $zenddir = $arr['zend']['zend_path'];
    // Setup include path
        //add zend directory to include path
    set_include_path(get_include_path().PATH_SEPARATOR.$zenddir);
    // Initialize Zend Framework loader
    require_once 'Zend/Loader/Autoloader.php';
    Zend_Loader_Autoloader::getInstance();
    // Load configuration
    $default_config = new Zend_Config(array("production" => false), true);
    $default_config->merge(new Zend_Config_Ini($configfile, 'zendamf'));
    $default_config->setReadOnly();
    $amf = $default_config->amf;
    // Store configuration in the registry
    Zend_Registry::set("amf-config", $amf);
    // Initialize AMF Server
    $server = new Zend_Amf_Server();
    $server->setProduction($amf->production);
    if(isset($amf->directories)) {
        $dirs = $amf->directories->toArray();
        foreach($dirs as $dir) {
            // get the first character of the path.
            // If it does not start with slash then it implies that the path is relative to webroot. Else it will be treated as absolute path
            $length = strlen($dir);
            $firstChar = $dir;
            if($length >= 1)
                $firstChar = $dir[0];
            if($firstChar != "/"){
                // if the directory is ./ path then we add the webroot only.
                if($dir == "./"){               
                    $server->addDirectory($webroot);
                }else{
                    $tempPath = $webroot . "/" . $dir;
                    $server->addDirectory($tempPath);
            }else{
                   $server->addDirectory($dir);           
    // Initialize introspector for non-production
    if(!$amf->production) {
        $server->setClass('Zend_Amf_Adobe_Introspector', '', array("config" => $default_config, "server" => $server));
        $server->setClass('Zend_Amf_Adobe_DbInspector', '', array("config" => $default_config, "server" => $server));
    // Handle request
    echo $server->handle();
    Now, upload your "My Release Build folder to your production server webroot"
    case 1: if you get "channel disconnected error, you have made some mistake and your path for zend or services folder is not right."
    In above case, "ZendFramework folder and services folder with all of other release files". To find out what is wrong, open this url :
    http://www.yourwebsite.com/gateway.php. if you see this lovely string there : "Zend Amf Endpoint". consider your are through with zend settings on server
    otherwse you will see relative errors.
    2. After fixing this step, try run your website, you will land into this error :
    Class “yourcorrectclassname” does not exist: Plugin by name ‘Classname’ was not found in the registry; used paths:
    : /home1/messoftc/public_html/oc/services/
    #0 /home1/messoftc/public_html/ZendFramework/library/Zend/Amf/Server.php(553): Zend_Amf_Server->_dispatch(‘fxnname’, Array, ‘classname’)
    #1 /home1/messoftc/public_html/ZendFramework/library/Zend/Amf/Server.php(629): Zend_Amf_Server->_handle(Object(Zend_Amf_Request_Http))
    #2 /home1/messoftc/public_html/oc/gateway.php(69): Zend_Amf_Server->handle()
    #3 {main}
    Now, this is a zend framework bug, it does not automatically detect the php classes in your services folder,those who have run into this, must have googled hard to find the solution and this bug is also logged officially on zend server jira log.
    so, what is the solution? simple and effective. open your gateway.php file from "My Release Build"
    Add this little line :
    $server->addDirectory(dirname(__FILE__) . '/services/');
    after this line :
    $server->setProduction($amf->production);
    reupload this file to your production, you should see your Flex, Zend, php & Mysql in action.
    Here is a sample link I have created :
    http://www.eiws.co.in/testzend.html
    you may also visit the endpoint file:
    http://eiws.co.in/gateway.php
    If anyone still faces this issue, can contact me at [email protected].
    Credits: "To all developers who share their knowledge with everyone and google and thousands of blogs who provide a medium to share this knowledge"

    Richard Bates of flexandair.com figured it out. In my php.ini file, I had the memory limit set at 8M. After, changing it to 32M, it worked. Thank you, Richard!
    -Laxmidi

Maybe you are looking for