The Contact Manager application has two parts: the Flex code (MXML and AS files) and the ColdFusion component (CFC) files. Here is what you need to do to get the Flex side working:
C:\fds2\jrun4\servers\default\samples if you installed Flex Data Services using the default settings. C:\fds2\resources\config\) to the <channels> section of the services-config.xml file (default location: C:\fds2\jrun4\servers\default\samples\WEB-INF\flex).
<!-- ColdFusion specific RTMP channel -->
<channel-definition id="cf-dataservice-rtmp" class="mx.messaging.channels.RTMPChannel">
<endpoint uri="rtmp://{server.name}:2048" class="flex.messaging.endpoints.RTMPEndpoint"/>
<properties>
<idle-timeout-minutes>20</idle-timeout-minutes>
<serialization>
<!-- This must be turned off for any CF channel -->
<instantiate-types>false</instantiate-types>
</serialization>
</properties>
</channel-definition>
<!-- ColdFusion specific HTTP channel -->
<channel-definition id="cf-polling-amf" class="mx.messaging.channels.AMFChannel">
<endpoint uri="http://{server.name}:{server.port}/{context.root}/messagebroker/cfamfpolling" class="flex.messaging.endpoints.AMFEndpoint"/>
<properties>
<serialization>
<!-- This must be turned off for any CF channel -->
<instantiate-types>false</instantiate-types>
</serialization>
<polling-enabled>true</polling-enabled>
<polling-interval-seconds>8</polling-interval-seconds>
</properties>
</channel-definition>
(Optional) Turn on the ColdFusion-specific debugging output. The service-config.xml file contains a <logging> section, which contains a <filters> tag with a list of patterns for debug output. To enable some helpful debugging output to the Flex 2 console, add a new <pattern> tag:
<pattern>DataService.coldfusion</pattern>
coldfusion-dao adapter to the data-management-config.xml file (default location:C:\fds2\jrun4\servers\default\samples\WEB-INF\flex). In the <adapters><adapter-definition id="coldfusion-dao" class="coldfusion.flex.CFDataServicesAdapter"/>
<destination id="cfcontact">
<adapter ref="coldfusion-dao"/>
<channels>
<channel ref="cf-dataservice-rtmp"/>
<channel ref="cf-polling-amf"/>
</channels>
<properties>
<component>samples.contact.ContactAssembler</component>
<scope>request</scope>
<metadata>
<identity property="contactId"/>
</metadata>
</properties>
</destination>
Find the "ColdFusion Sample" comment and copy everything from the <destination id="cfcontact"> tag to the </destination> end tag. To try the CRM example, you may copy the cfcompany and cfemployee destinations as well. Here is the cfcontact destination:
<destination id="cfcontact">
<adapter ref="coldfusion-dao"/>
<channels>
<channel ref="cf-dataservice-rtmp"/>
<channel ref="cf-polling-amf"/>
</channels>
<properties>
<component>samples.contact.ContactAssembler</component>
<scope>request</scope>
<metadata>
<identity property="contactId"/>
</metadata>
</properties>
</destination>
Start Flex. (If the server was already running, you may have seen it automatically restart when you changed its configuration files.) Look for the following line in the console output:
[Flex] [CFDataServicesAdapter] Configuring CFC adapter for destination cfcontact
To configure ColdFusion, follow these steps:
The ColdFusion back end is made up of three components:
alias attribute on the component that ColdFusion uses to map the CFC to the ActionScript 3.0 class.fill and get methods), notifies you of changes (the sync method), or finds out how much data a specific fill operation will return (the count method).To test that the CFML code is working, run <wwwroot>/samples/contact/testContactAssembler.cfm to verify that you have installed the components in the correct location and that the DAO CFC is working and connected to the data source. You should see a list of names that are in the contact database.
The Flex application is made up of four files:
destination attribute of the <mx:DataService> tag to be cfcontact to use this with the CFC assembler.You are now ready to run the copy of the Contact Manager application. Point your browser to the Flex samples directory in which you created a copy of the Flex sample application: http://localhost:8700/samples/dataservice/cfcontact/contactmgr.mxml. The page loads the sample; you can then create, update, and delete the data.