PDA

View Full Version : Accessing CFC with mx:RemoteObject


jce1975
09-25-2006, 03:23 PM
I have been trying to setup the Helloworld example from Adobe located here:

http://www.adobe.com/devnet/flex/articles/helloworld.html

However, because I don't have access the CF webroot directory, I can't place the Helloworld.cfc there. I tried placing the cfc in the same folder as the HelloWorld_ro.mxml file, but I can't seem to get the path right? Here is the error:

faultString: 'send failed'
faultDetail: 'Channel.Connect.Failed error
NetConnection.Call.Failed: HTTP: Failed'

I tried changing the source attribute but I just can't get it right. Can the cfc be placed anywhere or does it have to be in the CF webroot? Does anyone have an example of this?

I have my cfc located on my server in at the following path:

James/helloworld_cfc/HelloWorld.cfc

Thanks,

James

jce1975
09-25-2006, 06:56 PM
Do I need to setup up a new Destination in the services-config.xml file? I was able to view the file. Here it is:

<?xml version="1.0" encoding="UTF-8"?>
<services-config>

<services>
<service id="coldfusion-flashremoting-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>

<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="Error">
<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>
</system>

</services-config>

Thanks,

James

jce1975
09-28-2006, 01:43 PM
If anyone is interested, I believe the following article is a good answer to my problem ...

http://www.kenreiss.com/blog/index.cfm/2006/8/10/Flex-20-with-CFMX-702--SUCCESS

Tink
09-28-2006, 02:13 PM
hey jce

ColdFusion really aint my strong point but i've been messing with this today with stefan (http://www.flashcomguru.com/). we have it working so as soon as he gets a chance he's gonna post the approach.