Detailed instructions for use are in the User's Guide.
[. . . ] Using ColdFusion MX with Flex 2
Trademarks 1 Step RoboPDF, ActiveEdit, ActiveTest, Authorware, Blue Sky Software, Blue Sky, Breeze, Breezo, Captivate, Central, ColdFusion, Contribute, Database Explorer, Director, Dreamweaver, Fireworks, Flash, FlashCast, FlashHelp, Flash Lite, FlashPaper, Flash Video Encoder, Flex, Flex Builder, Fontographer, FreeHand, Generator, HomeSite, JRun, MacRecorder, Adobe Systems Incorporated, MXML, RoboEngine, RoboHelp, RoboInfo, RoboPDF, Roundtrip, Roundtrip HTML, Shockwave, SoundEdit, Studio MX, UltraDev, and WebHelp are either registered trademarks or trademarks of Adobe Systems Incorporated and may be registered in the United States or in other jurisdictions including internationally. Other product names, logos, designs, titles, words, or phrases mentioned within this publication may be trademarks, service marks, or trade names of Adobe Systems Incorporated or other entities and may be registered in certain jurisdictions including internationally. Third-Party Information This guide contains links to third-party websites that are not under the control of Adobe Systems Incorporated, and Adobe Systems Incorporated is not responsible for the content on any linked site. If you access a third-party website mentioned in this guide, then you do so at your own risk. [. . . ] The Distinguished Name, which contains the Common Name (cn) of the server. The encrypted storepass is stored in ColdFuison configuration files. Generates the certificate in the printable encoding format. Generates detailed certificate information.
-dname
-keystore
-keypass -storepass
-rfc -file -v
Next, you place the certificate you created in the file that the JVM uses to decide what certificates to trust. The file in which you put the certificate, (usually named cacerts), is located in the JRE, under the lib/security folder.
To configure Flex:
1.
Export the keystore to a certificate by using the keytool utility, with a command similar to the following:
keytool -export -v -alias FlexAssembler -keystore cf. keystore -rfc -file cf. cer
2.
Import the certificate into the JRE cacerts file for your server by using the keytool utility, with a command similar to the following:
keytool -import -v -alias FlexAssembler -file cf. cer -keystore C:\fds2\UninstallerData\jre\lib\security\cacerts
46
Using the Flex Data Service Assembler
The previous example specifies the location of the keystore for Flex Data Services with integrated JRun, installed using the default settings. If you are using a different server, specify the location of the cacerts file for the JRE that you are using. For example, if you are using JBoss, you specify the keystore location as $JAVA_HOME/jre/lib/security/
cacerts.
To enable SSL in the ColdFusion MX Administrator:
1.
In the ColdFusion MX Administrator, select Data & Services > Flex Integration, and specify the keystore file in the Full Path to Keystore text box. Specify the keystore password in the Keystore password text box. Select the Enable RMI over SSL for Data Management option, and then click Submit Changes. If you specify an invalid keystore file or password, ColdFusion does not enable SSL, and disables Flex Data Management Support.
2. 3.
Data translation
The following table lists the ColdFusion data types and the corresponding Adobe Flash or ActionScript data type: [arrays become lists - which are AS arrayCollections; ask mike]
ColdFusion data type
String Array Struct Query CFC
Flash data type
String [] = Array {} = untyped Object Array of untyped Objects Class = typed Object (if a matching ActionScript class exists, otherwise the CFC becomes a generic untyped Object (map) in ActionScript) ActionScript Date ActionScript String ActionScript Numeric ActionScript XML Object
CFC Date CFC String CFC Numeric ColdFusion XML Object
Data translation
47
Example application
This section describes creating a Flex application that uses the ColdFusion Data Service adapter and Flex Data Service assembler so that a ColdFusion component handles the backend database management. You can download the source code for the files that are included in the Flex sample Contact application from "Using ColdFusion with Flex Part 1: Creating and Running a Contact Manager Application. " In addition, you can view the code for the Flex sample Contact appliation in "The Flex Contact Manager Application" on page 62. To use ColdFusion instead of the Java adapter:
1. Create the Value Object CFC.
NO TE
To make creating the CFCs easier, ColdFusion MX 7. 0. 2 includes wizards that you can use in Flex Builder. For more information, see Chapter 5, "Using the ColdFusion Extensions for Flex Builder".
4. 6.
Specify the destination in the data-management-config. xml file. Copy the files for the Flex Contact sample application to the appropriate folders. Run the application.
Creating the assembler CFC
The assembler CFC contains the fill, sync, get, and count methods.
Creating the fill method
In the Contact sample application, the fill operation has two forms: one that takes no argument, and one that takes a string. The corresponding Java function returns a List of Contact objects. Because a List corresponds to an array in ColdFusion, the fill method returns an array of Contact objects. The fill method appears as follows:
<cffunction name="fill" output="no" returntype="samples. contact. Contact[]" access="remote"> <cfargument name="param" type="string" required="no"> <cfset var ret = ArrayNew(1)> <cftry> <cfset dao = CreateObject("component", "samples. contact. ContactDAO")>
48
Using the Flex Data Service Assembler
<cfif structKeyExists(arguments, "param")> <cfreturn dao. read(param=arguments. param)> <cfelse> <cfreturn dao. read()> </cfif> <!--- If the SQL failed, mark this change with the error. ---> <cfcatch type="database"> <cfset msg = "Error during fill: " & cfcatch. queryError & ". [. . . ] 2.
In Flex Builder, select Window > Show View > Other. Select ColdFusion > Services Browser. Browsing components Managing web services
The Services Browser can do the following:
Services Browser
87
Browsing components
The Service Browser lists the following components:
Components that the ColdFusion component browser lists The ColdFusion component browser is located at cf_root/wwwroot/CFIDE/ componentutils/componentdoc. cfm.
Components that are located in any directories specified in the ColdFusion MX Administrator Mappings page Components that are located in any directories specified in the ColdFusion MX Administrator Custom Tag paths page
You can restrict the list of CFCs according to whether the functions in a CFC are remote, public, or private. A sample element of the list appears as follows:
The first line of the listing contains the path. [. . . ]