4 Replies Latest reply on May 18, 2009 2:22 PM by Peter Farland

    AIR to CFC with RemoteObject

    jag57 Level 1

      I am having problems accessing a CFC on my local ColdFusion server from an AIR application.  I keep getting an error that I cannot connect to http://localhost:8501/flex2gateway/

       

      I know my CF8 server is running.  I have already enabled Flash remoting in the CF admin console.

       

      Here's my application MXML file, which is located in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\Test2\src:

       

      <?xml version="1.0" encoding="utf-8"?>
      <mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="init()">
      <mx:Script>
          <![CDATA[
              import mx.rpc.events.FaultEvent;
              import mx.rpc.AsyncToken;
              import mx.controls.Alert;
              import mx.rpc.events.ResultEvent;
             
              private function init():void
              {
                  var token:AsyncToken = service.getdata();
                  token.addResponder(new mx.rpc.Responder(resultHandler, faultHandler));
              }
             
              private function resultHandler(result:ResultEvent):void
              {
                  Alert.show(result.result.toString());
              }
             
              private function faultHandler(fault:FaultEvent):void
              {
                  Alert.show(fault.fault.toString());
              }
          ]]>
      </mx:Script>

      <mx:RemoteObject id="service"
           endpoint="http://localhost:8501/flex2gateway/"
           destination="ColdFusion"
           source="Test1.messageService"/>
         
      </mx:WindowedApplication>

       

      Here's my CFC which is C:\ColdFusion8\wwwroot\Test1\messageService.cfc

       

      <cfcomponent>
      <cffunction name="getdata" access="remote" returntype="string">
      <cfreturn "this is the return message">
      </cffunction>
      </cfcomponent>