Swiz RPC Library on RIAForge

Just a quick post to let folks know the source for the Swiz RPC Library, as well as the compiled SWC, are now available on RIAForge: http://swizrpc.riaforge.org.

Swiz RPC Library

A couple of weeks ago Joe Rinehart blogged about his RemoteMethodMediator for Swiz. Like Joe, I've found that most of my executeSeviceCall callback methods were just dispatching events via Swiz, so I liked the idea of skipping callbacks completely. However, I didn't really like Joe's implementation, so I yesterday I did some playing around and came up with the a Swiz RPC library. The library has swiz specific implementations of mx.rpc.remoting.mxml.RemoteObject, mx.rpc.remoting.mxml.Operation, and mx.rpc.CallResponder. These classes can be used in your bean loader in place of the standard mx:RemoteObject, mx:method, and mx:CallResponder tags.

[More]

Using Secure AMF Channels in Swiz

This question comes up quite a bit on the Swiz mailing list so I thought I'd write a blog post on how I handle this. For those new to Swiz, one very cool feature of the framework is the DynamicChannelSet wich allows you to remove the dependency on services-config.xml. Here is an example, from the Swiz docs, of how you would use DynamicChannelSet in your Bean Loader:

[More]

Flex Remoting to CFCs under a Fusebox 5.5.1 Application.cfc

I recently started using Fusebox again and one issue I ran into was that Flex Remoting calls to CFCs under my Fusebox application were not working. (The application in question used an extended version of Fusebox's Application.cfc.) To work around the issue I put the remote components under a different, minimal, Application.cfc which used the same name as my main applicaiton. Something like the following:

<cfcomponent>
<cfset this.name="myApp" />
</cfcomponent>

This fixed the issue, but I was still a little puzzled. It is well know that the Application.cfc onRequest method doesn't play well with Flex Remoting, but I looked at Fusebox's Application.cfc and thought it was handling the issue with the following code in onRequestStart:

<!--- ensure CFC / Web Service / Flex Remoting calls are not intercepted --->
<cfif right(arguments.targetPage,4) is ".cfc">
<cfset doCompile = false />
<cfset structDelete(variables,"onRequest") />
<cfset structDelete(this,"onRequest") />
<cfreturn/>
</cfif>

Well, today I had a little bit of time to look into this and it turns out that for Flex Remoting requests the targetPage is "/flex2gateway," not the name of the target CFC. It was a bit of a "duh" moment, because if you have ever looked at a services-config.xml file or watched Flex Remoting requests via a proxy like ServiceCapture then you know the URL used is something like http://localhost/flex2gateway. Anyway, to fix the issue I ended up modifing the Fusebox Application CFC code above to the following:

<cfif right(arguments.targetPage,4) is ".cfc" or findNoCase("/flex2gateway",arguments.targetPage) gt 0>
<cfset doCompile = false />
<cfset structDelete(variables,"onRequest") />
<cfset structDelete(this,"onRequest") />
<cfreturn/>
</cfif>

Now I no longer need to remember to add a custom Application.cfc for remote CFCs.

It is important to note that Flash Remoting can be configured to use any URL, but this at least covers the default configuration for ColdFusion.

BlogCFC was created by Raymond Camden. This blog is running version 5.8.001.