Friday, August 29, 2008

BlazeDS HTML LiveDocs updated

The BlazeDS HTML Livedocs are now updated to match the updated PDF files I posted about a while ago. This brings the BlazeDS document up to date with the release of LCDS 2.6, including a much better organization of the chapters to explain the RPC and messaging concepts.

I think most folks use the HTML version, not the PDF (I know I do), so it was pretty confusing having two different versions of the doc around, with the most popular being the out of date version.

Thanks to the documentation team for responding to our complaints!

Invoking Flash remoting requests using the Java AMF Library

In a follow up to my recent post about the new Java AMF client available in BlazeDS, I was recently asked how to send a 'typical' flash remoting request to ColdFusion.

Here is how you do that in Java:

Object[] args = ...
String sourceName = "my.cfc.path.Component";
RemotingMessage message = new RemotingMessage();
message.setMessageId(flex.messaging.util.UUIDUtils.createUUID());
message.setOperation("myCfcFunctionName");
message.setBody(args);
message.setSource(sourceName);
message.setDestination("ColdFusion");
Object returnValue = amfConnection.call(null, message);

and accessing the body of the response like this.

Object body = ((AcknowledgeMessage) returnValue).getBody();

Not that the "args" variable is an array of the arguments you are passing to the CFC function. It can also be a Java List, or a simple object. See the BlazeDS source for RemotingMessage.java for details. This sends the same kind of message that the mx:RemoteObject tag does in MXML, so in ColdFusion terms you are using the "Flash Remoting Update". If you use the 'raw' AMFConnection API, you would be using the "classic" Flash Remoting. Both will work, but I recommend using the RemotingMessage style.

What does this do for you? Well if you are exclusively using Flex as a client, not much. But if you would like to write Java code to invoke a CFC, this alows you to do that very easily.

Wednesday, August 06, 2008

New Java AMF Client feature in BlazeDS

You may not have noticed, (what, you aren't subscribed to the BlazeDS commits forum?) but a few weeks ago Mete committed an enhancement that adds a Java AMF client API to the flex-messaging-core.jar file in BlazeDS.

You can find a specification posted here and its linked from the Developer Documentation page.

What does this do? Well, you can use this API to call (from Java) Flash Remoting end points in BlazeDS, LiveCycle Data Services, ColdFusion, PHP or whatever you have that supports AMF. Which of course is a published specification.

This feature is available in any nightly build after 3.1.0.2602 or in the trunk nightly build. Find those builds on the BlazeDS build download page.