This HOWTO outline the steps necessary to get BlazeDS working with OpenBD. What you wind up with at the end of this process is the BlazeDS sample applications running alongside and hitting CFML pages and CFCs in OpenBD for remote services. These steps are essentially the reverse of the steps outlined by Paul Bonfanti here, and huge thanks again to Paul for writing the OpenBD Adapater that enables communication between Flex and OpenBD.
Current limitations of the OpenBD Adapter are:
If you DON'T want to go through these steps yourself, just grab this zip file that contains a blank slate of OpenBD + BlazeDS preconfigured for you. Note that this is NOT an official OpenBD release with BlazeDS rolled in; this is just OpenBD 1.1 with BlazeDS added manually. True integration between OpenBD and BlazeDS is on our roadmap for a future release. These steps should also be handy if you want to use a later version of either OpenBD or BlazeDS in the future, or if you just prefer doing things manually.
<listener-class>flex.messaging.HttpFlexSession</listener-class>
The entire <listener> node will now look like this:
<listener>
<listener-class>flex.messaging.HttpFlexSession</listener-class>
<listener-class>com.naryx.tagfusion.cfm.application.cfHttpSessionListener</listener-class>
</listener>
Next ...
<adapter-definition id="openbd-object" class="openbd.flash.messaging.OpenBDAdapter"/>
<adapters>
<adapter-definition id="openbd-object" class="openbd.flash.messaging.OpenBDAdapter" default="true"/>
<adapter-definition id="java-object" class="flex.messaging.services.remoting.adapters.JavaAdapter"/>
</adapters>
Note that you only really need to worry about the default setting if you have two destinations with the same path and name. How could this happen? Assume you have the Java class "path.to.MyService" in your classpath, and you also have the CFC "path.to.MyService" in the normal path traversal for CFCs. In this case if you have a destination defined as follows:
<destination id="myService">
<properties>
<source>path.to.MyService</source>
</properties>
</destination>
The path.to.MyService object it will use is the one it finds via the default adapter. Pretty rare situation but I thought it would be good to outline the behavior.
At this point you will have a "clean" setup of OpenBD with BlazeDS. To show how you configure your own applications to use this, the following outlines the steps involved with dropping a quick couple of samples I built into this clean OpenBD + BlazeDS setup. You can grab this samples bundle as a zip file, and it includes the source for the two sample Flex apps, and uses an embedded H2 database so there's no setup involved with getting things running other than dropping this onto your servlet container.
As you probably know if you're familiar with Flex, in order to use HTTP services and remote objects you have to configure destinations in the appropriate configuration files. Note that these need to be configured BEFORE you compile your SWFs because these configuration files are NOT read at run time.
Here's what I did to get the two samples, one using an HTTP service and one using a Remote Object, up and running.
<destination id="musicians">
<properties> <url>/{context.root}/samples/httpservice/musicians.cfm</url> </properties> </destination>
<destination id="musicianService">
<properties>
<source>samples.remoteobject.MusicianService</source>
</properties>
</destination>
Again, if you download the pre-built bundle you do not have to go through these steps. This is really to show you how this is done for your own apps.
And of course to deploy this to your servlet container, you can either WAR this all up or just deploy the directory structure as is to the servlet container of your choice. Then you can hit these URLs to see the samples in action:
These files are also linked from the default index.cfm page.
A final note concerning the sample apps--if you're messing around with them in a context path other than openbd-with-blazeds, the sample SWFs won't work. This is because the context path is set in the SWF at compile time. You can recompile the MXML files with the appropriate settings for your context path, however.
That's all for now--PLEASE let us know or update this information if it's inaccurate. I went through several iterations messing around with all of this so it's possible I missed a step or did something out of order.