• Link Title

    Short description of the page you're linking to

Flex Messaging on ColdFusion with BlazeDs

Curiosity got the  better of us at work this past week, we decided it was a good idea to test BlazeDs with ColdFusion and verify if we can get the Flex Messaging Service running and connected with our flex application.

On my laptop I got ColdFusion8 running with BlazeDS v 3.2 thanks to a post by Aaron West this was easy figuring out how to get access to the FMS Gateway within flex was shall I say a *****.

How to install BlazeDS on ColdFusion 8

Please watch the video on how to install Blaze DS on ColdFusion (running LCDS ES)

http://www.trajiklyhip.com/blog/index.cfm/2008/8/28/Integrating-BlazeDS-with-ColdFusion-8

NOTE: You may want to use the latest version of ColdFusion and Blaze available on Adobe's website.

Configure Flex Messaging Service on ColdFusion 8

Once we have ColdFusion 8 running with Flex the journey begins…

Step 1: We need to create a custom defination (I read somewhere we can do this realtime in Java, not sure how yet.)

Edit the messaging-config.xml file and add the following few lines of code

[The requested file http://www.hemtalreja.com/Mods/http://www.hemtalreja.com/Mods/blazeds/config/messaging-config.xml could not be found]

note: The "<adapter ref="actionscript" />" is really important, most Blaze tutorials do not include this single line of xml defination.

Flex Application as a Consumer & Producer for the FMS destination

[The requested file http://www.hemtalreja.com/Mods/http://www.hemtalreja.com/Mods/blazeds/MessagingService.as could not be found]

Function samples to dispatch and receive messages

[The requested file http://www.hemtalreja.com/Mods/http://www.hemtalreja.com/Mods/blazeds/MessagingService.as could not be found]

Note: Special thanks to Steve Brownlee (http://www.fusioncube.net) & Arron West for help with BlazeDs configuration.

Filed under: BlazeDS, ColdFusion, Flex, Uncategorized | 1 Comment

I’m Back

Sorry my server was unavailable for a while, the laptop I was using was acting up.

Got me an ASUS eee 1000HA to be my webserver running ubuntu & wordpress…

Filed under: Uncategorized | 1 Comment

Let the mind games begin

I intend to participate in a 200 mile bike race this year spanning 5 day’s this is just me preping my mind…

Filed under: Uncategorized | No Comments

Work Order Request Form

The work order request form is a Swiz Framework sample application, it is powered using Flex 3, ColdFusion 8.1 and My Sql 5.1.

To install and run this sample you will need the following applications

  • Adobe ColdFusion 8 (http://www.adobe.com/products/coldfusion/)
  • My SQL 5.1 (http://www.mysql.com/)
  • ColdSpring 1.2 (http://coldspringframework.org/)
  • Swiz Framework

Pre-Install Check list

  • Please verify you have Adobe ColdFusion 8+ installed.
  • Please verify you My SQL 5+ installed.
  • Please verify you have the ColdSpring Framework installed.

FEATURES

  • Request Creation
  • Approvals Routing
  • Email Messages (disabled)
  • Notes
  • Multiple Attachments
  • SOA Framework

INSTALL INSTRUCTIONS

DATABASE

  • Log into My SQL as root and execute the following scripts
  • worf_db\CREATE_TABLES_01.sql (this creates the “WORF” schema and tables the application needs)
  • worf_db\insert_worf_base_data_02.sql (this inserts the base data that the application requires to run)
  • You may want to create a database user and grant all access to the WORF screma, you may also use root as the user.
  • Access the ColdFusion Administrator and create a “WORF” datasource pointing to the work schema on the my sql server

WEB FILES

  • Copy the contents of the worf directory withing the archive into [WEB-ROOT]\webapps\worf
  • You can then access the application using http://LOCALHOST:[port]/webapps/worf/index.cfm

FLEX FILES

  • The files withing worfflex are a standard Flex Builder 3 project files.
  • DO NOT FORGET THE “-keep-as3-metadata+=Autowire,Mediate” compiler argument.
  • This application requires some FlashVars to be passed to it, hence you direct flex builder to call a custom ColdFusion template instead of the standard html template that is generated by flex.
  • You need to request the http://LOCALHOST:[port]/webapps/worf/worf.cfm when debugging your application. Instructions here

Work Order Entry screen

Work Order Entry screen


Work Order Dashboard

Work Order Dashboard


Database Design

Database Design



DOWNLOAD FILES

Filed under: ColdFusion, Flex, SOA, Sample Apps | 1 Comment

My moment of WOW

I’m new to Flex development about 4-5 months, started my first project using PureMVC. For reasons unknown to me I decided to re-write a part of the application using Swiz Framework.

I have to say I’m pretty impressed, I wish there was an Application template to help me get started or a defined way of writing code. After I tweaked my RemoteService.as file I got it working with Swiz’s CommandChain and my SOA back-end infrastructure remains unchanged.

The inversion of control functionality with the help of Dynamic Mediators & Swiz Controllers reduce code like I cannot believe.

Please give me a few weeks and I will share a Sample Application for the group to download and use with Swiz and ColdFusion.

I will also publish a wish list of Flex and Swiz, I wish there was a way to define meta data information in static const variables of XML files.

Filed under: Flex | No Comments

ColdFusion SOA back-end for Flex, AJAX using ColdSpring… Part 3

RemotingService.cfc

The gateway to the Application can be accesed using Web Service, Flash Remoting, Ajax… 

Currently it is the only component with methods of type “Remote”.

 

It is a really light weight component that will be created and deleted for every call.

  • Receive the Service Request
  • Pass the request to the “Service Runner
  • Receives the response from the service runner
  • Return the response to the calling application

 

soa/remoting/RemotingService.cfc

  1. <cfcomponent output="false"
  2. hint="This is the entry point into the application, exposed as a web-service or flash remoting service layer, or AJAX entry point.">
  3.  
  4. ...
  5. <cffunction name="InvokeService" access="remote" returntype="Any">
  6. <cfargument name="secureToken" type="string" required="true" />
  7. <cfargument name="eventName" type="string" required="true" />
  8. <cfargument name="eventData" type="Struct" required="false" default="#StructNew()#" />
  9.  
  10. <cfreturn  Application.coldSpring.getBean("serviceRunner").run(ArgumentCollection=Arguments) />
  11. </cffunction>
  12. ...
  13. </cfcomponent>

Filed under: ColdFusion, SOA | 3 Comments

ColdFusion SOA back-end for Flex, AJAX using ColdSpring… Part 2

Before I walk you through the “Remoting Layer” let’s set-up the application so we a configured and callable Business Object .

 

Setting up your Business Object

In the ColdSpring.xml file you will define your Business Objects.

<bean id="CurrentUserService" class="soa.model.security.CurrentUserService"/>

 

Mapping the Business objects to Events they can handle

Next we will map the businessObjects.MethodName() to the events they can handle.

  • Bean Id: “event.getCurrentUserPreferenceObject” is the name of the event / requested data.
  • property: CurrentUserService is the business component that should respond to this request.
  • property: getCurrentUserPreferenceObject is the name of method in the Business Object that will respond


<bean id="event.getCurrentUserPreferenceObject" class="soa.remoting.RemoteEventMap">
  <property name="beanName"><value>CurrentUserService</value></property>
  <property name="methodName"><value>getCurrentUserPreferenceObject</value></property>
</bean>

An event can be mapped to one BusinessObject.Method() , however a a BusinessObject.Method() can respond to multiple events.

The bean id should contain the “event. + Name of the Event eg:”event.getCurrentUserPreferenceObject“ 

This is primarily because I got lazy and am using ColdSpring to manage the Event definitions.

 

TESTING & NOTES

I request/recommend you making a call to the service layer to test your code every time you add an Event and or a Business Component.

You need to call http://localhost/soa/test/nativecall.cfm?appRestart=1 to restart the application if you are using the demo code

 

I use the following code to test my Events (requests) in ColdFusion before I call the service from within Flex.

  1. <!--- OUTPUT THE USER OBJECT. --->
  2. <cfset eventName = "getCurrentUser" />
  3. <cfset args = StructNew() />
  4. <cfset args.token = client.appToken />
  5.  
  6. <cfinvoke returnvariable="myWSFeedback" method="InvokeService"
  7. component="#Application.cfcPrefix#.remoting.RemotingService">
  8. <cfinvokeargument name="secureToken" value="#client.appToken#" />
  9. <cfinvokeargument name="eventName" value="#eventName#" />
  10. <cfinvokeargument name="eventData" value="#args#" />
  11. </cfinvoke>
  12.  
  13. <cfdump var="#myWSFeedback#" expand="true" />

Filed under: ColdFusion, SOA | No Comments

ColdFusion SOA back-end for Flex, AJAX using ColdSpring… Part 1

We were required to write our first Flex Application using ColdFusion as the back-end and Flex as the front end. Since the front end of this application is purely Flex driven the use for frameworks such as Model-Glue and Mach-II were not an option as flex integration is really a hack.

We opted to use Flash Remoting (AMF) to transfer objects between Flex and ColdFusion 7 (it only gets sweeter with CF8), for the ColdFusion back-end we wanted something that is easily extended and decoupled.

I found three primary ways to expose the ColdFusion Component to the flex Application.

  1. Have multiple entry points into the ColdFusion Application.

    I was not to crazy about this idea as front end needs to know what component it should call including the fully qualified path and the name of the function.

  2. Have one RemotingFacade.cfc that will be the entry point into the application with multiple functions that expose the underlying business logic. 

    This is a slightly better option as the user interface does not need to be aware of business objects just method names (”event names”) example: getAllUsers, getCurrentUser, etc…
    There is one drawback in this process, that is your RemotingFacade.cfc will grow based on every additional event you pass through your service.

    note: ColdSpring will help Auto-Create this/these components when the Application starts-up, read… Remote Proxies

  3. What I would like to do is have a RemotingFacade.cfc but move the event definitions into an XML file so I wrote one.

Software Requirements

  • ColdFusion MX 7 or ColdFusion 8 (http://www.adobe.com)
  • ColdSpring 1.2 (http://www.coldspringframework.org)

Let’s get started.

Before we continue, I have to admit, my approach to the design concept was based on something I read in one of the ColdFusion forums and or blogs a while back, I’d like to say it was http://www.model-glue.com or http://www.corfield.org.
The architecture consists of
  • RemotingService.cfc

    A light weight component that is your entry point into the application. This is the only component that has methods with access type of “Remote”

  • ServiceRunner.cfc 

    The actual component that calls your business logic components, This should be called “RemoteDelegate” or something.

  • RemoteEventMap.cfc

    These are mapping beans initialized by ColdSpring one per event type. 

  • ColdSpring.xml

    This is your ColdSpring file that contains the mapping information as bean definitions. If you are using ColdSpring 1.2  you can move the definitions into and EventMaps.xml and include this file into ColdSpring.xml

 

 

Benefits:

  • One entry point into the Application.
  • Authentication of the request.
  • Easy to extend and add functionality such as 
    • Logging of requests 
    • Reporting on execution time 
    • Centralized error handler
    • etc..
  • Availabily of powerfull tools such as IOC (Inversion Of Control) & AOP (Aspect-Orientied Programming) thanks to the ColdSpring framwork (more on this in weeks to come.)

 

 

 

DEMO & INSTALLATION

Since this post is going to span a few pages (days), feel free to download and access the nuts and bolts of this application.

Filed under: ColdFusion, SOA | No Comments

Flex QTP Automation runtimeloading component with FlashVars

So if you are developing Flex applications that require FlashVars to start-up and would like to use an Automation Tool here is the replacement of the runtimeloading.mxml that is provided runtimeloading.

Continue reading…

Filed under: Uncategorized | No Comments

Flex Builder 3: Using a custom template for debugging

Friends were wondering how to use a ColdFusion template as the default template for debugging a flex application.

The settings you need to consider are in the Project Properties

  • Run / Debug Settings
  • Flex Build Path
  • Flex Compiler


Flex Build Path:

  • Output Folder:

This is the full path to the debug folder,
example:
C:\Inetpub\wwwroot\myProject\bin-debug\

  • Output Folder URL:

This is the URL Path to the debug directory
example:
http://localhost/myProject/bin-debug/


Flex Compiler:

  • Copy non-embeded files to output folder: (checked)

This will move all coldfusion, asp, php files to the output (debug & export) folder

  • Generate HTML wrapper file: (unchecked)

This instructs the ant script to generate the HTML Wrapper and all supporting files

Debug Settings

  • URL or path to launch:

Change the url to point to the ColdFusion files
example:
http://localhost/myProject/bin-debug/index.cfm?yourVariable1=One

Filed under: Flex | 1 Comment