I have a bit of time before I start working on a new project and I would like to learn how to use remote objects. I have written a really simple app that uses remote objects to call information from my cfc and display it. However everything I have tried ends up with the same error.

Bit of information, I am using the coldfusion connectivity extention for f2b, I am running the newest version of cf.

I have my local cf server running at.
C:\CFusionMX7\wwwroot

My compiled swf is in
C:\CFusionMX7\wwwroot\test

My CFC is in
C:\CFusionMX7\wwwroot\test\com

Here is my code.

ERROR THAT I GET--
(mx.rpc::Fault)#0
  description = "Could not find the ColdFusion Component com.testCFC."
  detail = "Please check that the given name is correct and that the component exists."
  errorID = 0
  faultCode = "Server.Processing"
  faultcode = "Server.Processing"
  faultDetail = "Please check that the given name is correct and that the component exists."
  faultString = "Could not find the ColdFusion Component com.testCFC."
  faultstring = "Could not find the ColdFusion Component com.testCFC."
  message = "faultCode:Server.Processing faultString:'Could not find the ColdFusion Component com.testCFC.' faultDetail:'Please check that the given name is correct and that the component exists.'"
  rootCause = (null)


FLEX CODE:--

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">

    <mx:RemoteObject
        id="dataManager"
        showBusyCursor="true"
        destination="ColdFusion" source="com.testCFC">
        <mx:method name="testQuery" result="testQuery_result(dataManager.testQuery_result.result)" fault="server_fault(event)" />
    </mx:RemoteObject>
   
    <mx:Script>
        <![CDATA[
           
            import mx.rpc.events.FaultEvent;
            import mx.rpc.events.ResultEvent;           
            import mx.utils.ObjectUtil;
            import mx.controls.Alert;
           
            private function server_fault(event:FaultEvent):void
            {
                // dump error message
                errorArea.text = ObjectUtil.toString(event.fault);
            }
           
            private function testQuery_result(result){
                testDG.dataProvider = result;
            }
           
            private var _key:Object;

            [Bindable]
            public function get key():Object
            {
                return this._key;
            }
            public function set key(key:Object):void
            {
                this._key = key;
            }

            private function initComponent():void
            {
                refreshList(null);
            }

            public function refreshList(event:Event):void
            {
                this.dataManager.testQuery(this.key);
            }
           
        ]]>
    </mx:Script>
    <mx:DataGrid id="testDG" x="10" y="20">
        <mx:columns>
            <mx:DataGridColumn headerText="Column 1" dataField="fld_officeId"/>
            <mx:DataGridColumn headerText="Column 2" dataField="col2"/>
            <mx:DataGridColumn headerText="Column 3" dataField="col3"/>
        </mx:columns>
    </mx:DataGrid>
    <mx:Button x="320" y="19" click="initComponent()" label="Display"/>
    <mx:TextArea x="10" y="170" id="errorArea" width="590" height="251"/>
   
</mx:Application>


CFC CODE--
<cfcomponent>
           
    <cffunction name="testQuery" access="remote" output="false" returntype="query" >
        <cfquery name="testQry" datasource="#application.dsn#">
            select * from tbl_smartPanel_companyInfo
        </cfquery>
       
        <cfreturn testQry />
    </cffunction>
           

</cfcomponent>

flex-enterprise-services FILE CODE --

  <?xml version="1.0" encoding="UTF-8" ?>
- <services-config xmlns="http://www.macromedia.com/2005/flex-service-config">
- <services>
- <service id="hs2f-service" class="flex.messaging.services.RemotingService" messageTypes="flex.messaging.messages.RemotingMessage">
- <adapters>
  <adapter-definition id="cf-object" class="coldfusion.flash.messaging.ColdFusionAdapter" default="true" />
  </adapters>
- <destination id="ColdFusion">
- <channels>
  <channel ref="my-cfamf" />
  </channels>
- <properties>
  <source>*</source>
- <!--
 define the resolution rules and access level of the cfc being invoked 
  -->

 
- <access>
- <!--
 Use the ColdFusion mappings to find CFCs, by default only CFC files under your webroot can be found. 
  -->
  <use-mappings>false</use-mappings>
- <!--
 allow "public and remote" or just "remote" methods to be invoked 
  -->
  <method-access-level>remote</method-access-level>
  </access>
- <property-case>
- <!--
 cfc property names 
  -->
  <force-cfc-lowercase>false</force-cfc-lowercase>
- <!--
 Query column names 
  -->
  <force-query-lowercase>false</force-query-lowercase>
- <!--
 struct keys 
  -->
  <force-struct-lowercase>false</force-struct-lowercase>
  </property-case>
  </properties>
  </destination>
  </service>
  </services>
- <security>
  <login-command class="flex.messaging.security.JRunLoginCommand" server="JRun" />
  </security>
- <channels>
- <channel-definition id="my-cfamf" class="mx.messaging.channels.AMFChannel">
  <endpoint uri="http://{server.name}:{server.port}{context.root}/flex2gateway/" class="flex.messaging.endpoints.AMFEndpoint" />
- <properties>
  <polling-enabled>false</polling-enabled>
- <serialization>
  <instantiate-types>false</instantiate-types>
  </serialization>
  </properties>
  </channel-definition>
  </channels>
- <logging>
- <target class="flex.messaging.log.ConsoleTarget" level="Debug">
- <properties>
  <prefix>[Flex]</prefix>
  <includeDate>false</includeDate>
  <includeTime>false</includeTime>
  <includeLevel>false</includeLevel>
  <includeCategory>false</includeCategory>
  </properties>
- <filters>
  <pattern>Endpoint.*</pattern>
  <pattern>Service.*</pattern>
  <pattern>Configuration</pattern>
  <pattern>Message.*</pattern>
  </filters>
  </target>
  </logging>
- <system>
- <locale>
  <default-locale>en</default-locale>
  <supported-locale>de</supported-locale>
  <supported-locale>fr</supported-locale>
  <supported-locale>es</supported-locale>
  </locale>
- <redeploy>
  <enabled>true</enabled>
  <watch-interval>20</watch-interval>
  <watch-file>{context.root}/WEB-INF/flex/flex-enterprise-services.xml</watch-file>
  <touch-file>{context.root}/WEB-INF/web.xml</touch-file>
  </redeploy>
  </system>
  </services-config>





--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com




SPONSORED LINKS
Web site design development Computer software development Software design and development
Macromedia flex Software development best practice


YAHOO! GROUPS LINKS




Reply via email to