If you have not done so, start with the first part of this tutorial. This is part 2 of the Employee Manager application that I created a month ago. I think this is good timing since Milan added a comment asking about how we would add new employees to the database, not just edit and delete. So here we go, in this post, we will start where we left off in my initial tutorial.
Similar to my previous ColdFusion sample that uses LiveCycle Forms, this is part 1 of a Flex and LiveCycle Forms sample.
The goal of this sample is to demonstrate how you can create a Flex application that can use LiveCycle Forms to render PDF and HTML forms from XML form templates (XDP) created in Adobe Designer. The Flex application will display a list of pre-designed forms, sample xml data files (that can be used to pre-populate the forms) and available transformations. Once a form and optional XML data file have been selected, click on the Render Form button. This will make a call to LiveCycle Forms which will render the form on the server and return the result to the Flex application. Since Flash cannot embed PDF or HTML, I have lifted Christophe’s IFrame sample. Basically, the PDF and HTML content returned from LiveCycle Forms is displayed in an IFrame on top of Flash. There are still some issues I have to work out regarding re-sizing etc. I’ll post an update as soon as I have time to look into it.
An optional part of this sample is to display performance numbers. When LiveCycle Forms is rendering the form template into PDF or HTML, I collect the number of milliseconds that it took to render the form. That performance data can be pushed to the flex application using JMS. This option is turned off by default, please read the README.HTML file to see what needs to be done to turn this option on.
This sample will showcase several Flex Data Services 2 capabilities. The first one being RPC Services. This sample uses a Java Object named FileUtils that I created that implements several file I/O functions. One of these function is listFilesFromURL(url). This function will return a string array of files available at the provided URL. That is the function that is used to display the list of available forms and XMl data files. This function was tested with JRun as well as WebLogic directory listings. If there any issues with the code, let me know. The other Flex Data Services 2 capability showcased in this sample is real-time messaging. If you choose to enable the JMS capabilities of this sample, everytime a form is rendered, the performance data is sent to a JMS topic and Flex will detect that message and grab the value which will be displayed in the graph. The really cool thing about this feature is that every person running this application will see all of the performance data, not just their own.
You will need LiveCycle Forms as well as Flex Data Services. Check out these links to get access to the software.
Get the LiveCycle Developer Toolbox
Get Flex Data Services 2 Trial
I’m working on getting the application hosted somewhere accessible to you can try it… Stay tuned.
Sample Installation Instructions
Download the Sample Files
Are you a Java developer interested to know what’s all the fuss about Flex? Then I highly recommend that you take 30 minutes from your busy schedule and try Christophe’s 30 minute Flex Test-Drive for Java Developers. This comprehensive test-drive will walk you through connecting java backends to Flex. This will give you a glimpse on how you can break out of the limitations of the browser and pimp up the interface to your applications.
I think that the theme for MAX 2006: “Beyond boundaries” is dead on! This year’s MAX is not just about the familiar players – Flash,Flex, ColdFusion and Dreamweaver… Make sure you check out the LiveCycle sessions. Among these sessions, you’ll hear about Titan (the next generation of LiveCycle) – you DO NOT want to miss that one!!! Also, Christoph Rooms will be talking about integrating Flex and LiveCycle - truly going beyound boundaries. On that note, please read Steven Webster’s blog entry on Flex and LiveCycle… Other LiveCycle sessions at MAX will cover Designer, Workflow and Forms.
Thanks to Mike Potter for setting up a Google Calendar for the sessions.
Register for MAX 2006 NOW!
This is part 1 of this ColdFusion to LiveCycle Forms integration sample.
In this sample, the index.cfm page displays a series of basic options (form file to render, pre-population data, etc.) that will be used to pass as arguments to LiveCycle Forms. Once the form has been generated, it is then displayed to the browser. Once the form has been completed, it is then submitted to LiveCycle Forms to perform final validations, and extract the XML data. That XML data is then in turn saved to on the server for storage.
The sample is built on the LiveCycle Forms client libraries (formserver-client.jar) . From the client library, I am using the SOAPClient() object to remotely connect to an instance of LiveCycle Forms running on another Application Server. All of the “magic” happens within the LiveCycleForms.cfc. There are three functions in this CFC: renderForm [makes a call to LiveCycle Forms via SOAP to render a form and can optionally merge XML data to pre-populate], processFormSubmission [passes the submitted form to LiveCycle Forms to execute server-side calcs, validiations etc. If the form is complete, the data is extracted and returned to ColdFusion], BinaryWriteToClient [since LiveCycle Forms deals only in byte arrays, I have included a function that will directly write the result to the browser instead of writing to the server's disk and referencing the new file - much better performance and more scalable].
To get this sample to work, you will need the following:
- A working instance of LiveCycle Forms (please consult the product documentation on how to determine the SOAP end point for the web service interface).
- A working instance of ColdFusion with the following JAR files copied into the cfusion/lib folder: formserver-client.jar, um-client.jar and adobe-common.jar (these files are provided with the LiveCycle Forms install)
NOTE: Please read the comments in the CFM and CFC files for specific configuration changes that are required.
Download the sample files .