BlazeDS is removed in ColdFusion. See Deprecated features for more information.
To specify a CFC to connect to, you do one of the following:
- Specify the dot-delimited path from the web root to the CFC in the MXML.
- Create a named resource for the CFC. Creating this resource is like registering a data source; you then use the resource name in your XML.
Specify the CFC in the MXML
To specify the CFC in your MXML, use code such as the following:
<mx:RemotObject |
ColdFusion supports BlazeDS that allows messaging support for ColdFusion. When you install ColdFusion, the following files are added to the /WEB-INF/flex directory:
- remoting-config.xml
- messaging-config.xml
- services-config.xml
- proxy-config.xml
The destination ColdFusion is preconfigured in remoting-config.xml. The default source value for this destination is the wildcard, *. For more information about the changes in Flash Remoting for ColdFusion, see Changes in the XML configuration files for Flash Remoting in ColdFusion.
You do not have to use the ColdFusion destination if you have configured other valid destinations in the configuration file. In this case, the destination definition must specify * as the value of its source element. If you specify a source other than * in remoting-config.xml, then that source definition overrides the source specified in the MXML.
For details of defining a destination, see Create a named resource for a CFC below.
Create a named resource for a CFC
Edit the WEB-INF/flex/remoting-config.xml file by adding a destination entry for the CFC, for example:
<service id="remoting-service" class="flex.messaging.services.RemotingService" messageTypes="flex.messaging.messages.RemotingMessage">
<adapters>
<adapter-definition id="cf-object"
class="coldfusion.flash.messaging.ColdFusionAdapter" default="true" />
<adapter-definition id="java-object"
class="flex.messaging.services.remoting.adapters.JavaAdapter" />
</adapters>
<default-channels>
<channel ref="my-cfamf" />
</default-channels>
<destination id="ColdFusion">
<channels>
<channel ref="my-cfamf" />
</channels>
<properties>
<source>*</source>
</properties>
</destination>
</service>The sourceattribute specifies the dot notation to the CFC from the web root (the classpath to the CFC). The channel-ref tag refers to the channel-definition in the services-config.xml file. In the preceding sample, the my-cfamf channel-definition has been referenced, which looks similar to the following:
<channel-definition id="my-cfamf" class="mx.messaging.channels.AMFChannel"> <endpoint uri="http://{server.name}:{server.port}{context.root}/flex2gateway/" class="coldfusion.flash.messaging.CFAMFEndPoint" />
<properties>
<polling-enabled>false</polling-enabled>
<serialization>
<enable-small-messages>false</enable-small-messages>
</serialization>
<coldfusion>
<access>
<use-mappings>true</use-mappings>
<method-access-level>remote</method-access-level>
</access>
<use-accessors>true</use-accessors>
<use-structs>false</use-structs>
<property-case>
<force-cfc-lowercase>false</force-cfc-lowercase>
<force-query-lowercase>false</force-query-lowercase>
<force-struct-lowercase>false</force-struct-lowercase>
</property-case>
</coldfusion>
</properties>
</channel-definition>- Restart the ColdFusion server.
The following table describes the XML attributes for remoting-config.xml:
Element |
Description |
---|---|
destination id |
The destination attribute that the MXML mx:RemoteObject tag must specify to access the CFC. |
channels |
A container for one of more child channel attributes specifying the AMF channels to use to access the ColdFusion server. |
channel-ref |
Reference to the channel-definition id specified in the services-config.xml file. |
source |
The dot-delimited file path to the CFC, from the cfWebRoot, or, if the use-mappings property is true, an entry in the ColdFusion Administrator Mappings page. |
access |
Properties that control how the CFC is accessed on the ColdFusion server. |
The following table lists the XML attributes for services-config.xml:
Elements |
Description |
|
---|---|---|
channel-definition id |
Channel definition |
|
coldfusion |
Contains tags to set access levels, mappings to find CFCs, access to public or remote methods. |
|
access |
define the resolution rules and access level of the CFC being invoked |
|
use-mappings |
Use the ColdFusion mappings to find CFCs, by default only CFC files under your web root can be found. |
|
method-access-level |
Allow "public and remote" or just "remote" methods to be invoked |
|
use-accessors |
Whether the Value Object CFC has getters and setters. Set the value of use-accessors to true if there are getters and setters in the Value Object CFC. |
|
use-structs |
Set the value of use-structs to true if you don't require any translation of ActionScript to CFCs. The assembler can still return structures to Flex, even if the value is false. The default value is false. |
|
|
Whether to make property names, query column names, and structure keys lowercase when converting to ActionScript. Query column names must precisely match the case of the corresponding ActionScript variables. The default value is false. |