2 Replies Latest reply on Nov 7, 2009 3:42 AM by Shivik

    Problem in mapping remoteobject on server side

    Shivik Level 1

      Hello all

       

      I am trying to use remoteobjects in Flex and PHP via Zend_AMF.  I am having problem in mapping the data object in flex with the one in PHP.

      Here's my code....

       

      private function getAuthors(event:Event):void
      {
           serviceRO = new RemoteObject();
           serviceRO.endpoint = "http://localhost/sampleproj/public/";
           serviceRO.destination = "zend";
           serviceRO.source = "MyService";
           serviceRO.addEventListener(FaultEvent.FAULT, faultListener);
           serviceRO.getData.addEventListener(ResultEvent.RESULT, resultListener);
      }
      

       

      Now, here's the server side directory structure that works for me....

      webroot
      + sampleproj
      ++ public
      +++ index.php (index file for the webapp)
      +++ MyService.php (this is the service class)
      +++ VOAuthor.php (this is the Value Object class)
      

      Since the index file, and the service file and value object are all in same directory, it works.

       

      This is what DOESN'T work....

      webroot
      + sampleproj
      ++ services
      +++ MyService.php (this is the service class)
      ++ vos
      +++ VOAuthor.php (this is the Value Object class)
      ++ public
      +++ index.php (index file for the webapp)

       

      The error that I get is:

      Channel.Connect.Failed error

       

      Here's little of something that's going on in index.php

      <?php
      require_once ('C:/webtools/zendframework/zf/library/Zend/Amf/Server.php');
      
      require_once ( realpath(dirname(__FILE__) . '/../services/MyService.php') );
      
      $server = new Zend_Amf_Server();
      $server->setClass("MyService"); // adding the class to AMF server
      $server->setClassMap("VOAuthor", "VOAuthor"); // mapping the ActionScript VO to PHP VO
      
      echo($server->handle());
      ?>
      

       

      My guess is that in ActionScript code I have to do something with RemoteObject's endpoint.

       

      Can anybody please help me out with this?

       

      Thanks and Regards

      ShiVik