5 Replies Latest reply on Nov 30, 2009 6:48 PM by Omar_Gonzalez

    Problem in setting up Cairngorm with RemoteObject

    Shivik Level 1

      Hello all

       

      I am using Flex 3.4 and Cairngorm 2.2 and Zend_AMF for server side. I am having problem in setting up RemoteObjects.

       

      I am getting the infamous Channel disconnected error.

       

      [RPC Fault faultString="Channel disconnected"
      faultCode="Client.Error.DeliveryInDoubt" faultDetail="Channel
      disconnected before an acknowledgement was received"]

       

      When I do not use Cairngorm and use a simple RemoteObject in a mxml file, then everything works fine which suggests that there is no error on php side. Can somebody help me out? I am following the tutorial over here:

       

      DavidTucker.net » Blog Archive » Getting Started with Cairngorm – Part 4 http://j.mp/3ERPQB

       

      Here's my php service

      // LoginService.php
      <?php
      class LoginService {
           public function doLogin($username, $password) {
                return true; // just trying to see if the service returns something
           }
      }
      
      // LoginVO.php
      <?php
      class LoginVO {
           public $_explicitType = 'LoginVO';
           public $username;
           public $password;
      }
      // AMFServer.php
      <?php
      // setup APPLICATION_PATH and include Zend libraries here
      
      $server = new Zend_Amf_Server();
      $server->addDirectory(APPLICATION_PATH . '/services/');
      $server->AddDirectory(APPLICATION_PATH . '/vos/');
      echo $server->handle();
      

       

      WIth kind regards

      ShiVik

        • 1. Re: Problem in setting up Cairngorm with RemoteObject
          satyajitbehera

          Can you post the code where you have used the RemoteObject. Just send the ServiceLocater and the delegate you have used.

          • 2. Re: Problem in setting up Cairngorm with RemoteObject
            Shivik Level 1

            Hello there.

             

            Here's the ServiceLocator and delegates I am using....

             

            // LoginDelegate.as
            package com.myproj.products.business {
                 import com.myproj.products.vo.LoginVO;
                 import mx.rpc.IResponder;
                 import com.adobe.cairngorm.business.ServiceLocator;
            
                 
                 public class LoginDelegate {
                      // anything that implements the IResponder interface can act as a responder
                      private var responder:IResponder;
                      private var service:Object;
                      
                      public function LoginDelegate(responder:IResponder) {
                           this.responder = responder;
                           this.service = ServiceLocator.getInstance().getRemoteObject("loginService");
                      }
                      
                      public function login(loginAttempt:LoginVO):void {
                           // Call the method of service that resides on server
                           var call:Object = service.login(loginAttempt);
                           
                           // Send the response to responder
                           call.addResponder(responder);
                      }
                 }
            }
            

             

            // com/myproj/products/business/Services.mxml
            <?xml version="1.0" encoding="utf-8"?>
            <cairngorm:ServiceLocator
                 xmlns:mx="http://www.adobe.com/2006/mxml"
                    xmlns:cairngorm="com.adobe.cairngorm.business.*">
            
                 <!-- Login Service -->
                 <mx:RemoteObject
                      id="loginService"
                      destination="zend"
            
                      source="LoginService"
                      showBusyCursor="true">
                      
                      <mx:method name="doLogin" />
                      
                 </mx:RemoteObject>
            </cairngorm:ServiceLocator>
            

             

            With kind regards

            ShiVik

            • 3. Re: Problem in setting up Cairngorm with RemoteObject
              Shivik Level 1

              I have been trying to get this working but to no avail. An update - I have tried the zend_amf service browser over here - http://www.zamfbrowser.org and it is correctly displaysing the services I have created. But I am not able to map the same from Flex using Cairngorm.

               

              Using just the RemoteObject without Cairngorm still works well.

               

              I would be thankful for any guidance.

               

              Thanks and Regards

              ShiVik

              • 4. Re: Problem in setting up Cairngorm with RemoteObject
                Shivik Level 1

                Finally. I have been to solve this problem. The thing is that I had a problem in the delegate of my cairngorm application. According to the tutorial I was passing a value object as an argument to service in PHP but in the service I had to pass two arguments, username and password.

                 

                So I had to change that. Using Charles Proxy Sniffer was the key to solving the problem. Thanks to a post of Mihai Corlan I was able to solve the problem.... here's the link

                 

                How to debug Flex/AIR and PHP applications : Mihai CORLAN http://j.mp/vrZ4x

                 

                With best regards

                ShiVik

                • 5. Re: Problem in setting up Cairngorm with RemoteObject
                  Omar_Gonzalez Level 1

                  It is probably two weeks too late, but I just added a code generation feature for Zend AMF servers in ZamfBrowser.  If you already downloaded the AIR application it should offer an auto-update when you open the app.  Good luck on your project!

                  1 person found this helpful