Merapi within Cairngorm Command.as

9 views
Skip to first unread message

metamagpie

unread,
Aug 7, 2009, 3:53:46 AM8/7/09
to Merapi
Hi Everyone,

I have been experimenting with implementation using Merapi and
encountered this problems which I would like to seek your help on:

For sending messages from an Adobe AIR client to a Java application,
all the examples quoted online seem to implement message sending and
handling within an MXML file. I'm currently using the Cairngorm
framework which requires me to implement business logic within a
Command .actionscript file. Here's an example of code I've written
within the actionscript file which implements the IResponder
interface:

var openMsg:OpenFileMessage=new OpenFileMessage();
openMsg.filename=selectedFile.nativePath;
openMsg.send(this);

I have also included code for handling messages received from Java
within the result() and fault() methods. The code is as follows:

public function result(event:Object):void
{
if (event != null)
{
var openFileMsg:OpenFileMessage=(event as OpenFileMessage);
displayFileDetails(openFileMsg.filedata);
}
}

Here's the example of code I've written at the Java messageHander
application which handles messages sent by the AIR application:

public void handleMessage( IMessage message )
{
if ( message instanceof OpenFileMessage )
{
OpenFileMessage openMsg = ( OpenFileMessage ) message;
System.out.println( "Received command to open:
"+openMsg.getFilename() );

FileData retData = getFileData(openMsg.getFilename());
openMsg.setFileData(retData);
openMsg.send();
}
}

As seen from the method above, the Java application stores file data
into the message and passes it back to the AIR client, which displays
file details via the result() method.

I am able to successfully exchange messages between AIR and Java for
the first file opened. If I chose to open another file, the message
from AIR successfully gets received by the Java application which
retrieves file details into the received message. However, when the
Java application sends the message back to AIR (2nd file details), the
message does not get received with an error "82488 [Thread-2] ERROR
merapi.io.amf.AMF3Reader - Unknown AMF type '101'" logged by Merapi
bridge. I don't think the AMF error happened due to object
serialization as the same code works perfectly on BlazeDS.

Could anyone assist me with what could be the possible problem and any
solutions you might know to remedy it? I was also wondering if my
implementation for handling message on AIR is correct as i'm using the
IResponder to handle messages. Hope my post wasn't too wordy but I'd
like to thank you all for taking the time to read it.

Thanks again!

metamagpie

unread,
Aug 12, 2009, 10:27:35 PM8/12/09
to Merapi
Problem was solved by extracting the latest build of both Java and
Flex versions of Merapi from the SVN. So similar to the new posts,
only the AMF error 'XX' remains but program is functional.

Thanks!

Adam Flater

unread,
Sep 16, 2009, 1:13:53 PM9/16/09
to merapi-...@googlegroups.com
The amf error was recently fixed.. please update and give it a shot.

emtege

unread,
Nov 4, 2009, 8:33:32 AM11/4/09
to Merapi
I'm running into the same error, but apart from the log everything
seems to work correctly.
Am I up to date with "/svn/branches/as3-js-cs-core-devel" ?

On Sep 16, 6:13 pm, Adam Flater <adamfla...@gmail.com> wrote:
> The amf error was recently fixed.. please update and give it a shot.
>

emtege

unread,
Nov 4, 2009, 8:33:56 AM11/4/09
to Merapi
I'm running into the same error, but apart from the log everything
seems to work correctly.
Am I up to date with "/svn/branches/as3-js-cs-core-devel" ?

On Sep 16, 6:13 pm, Adam Flater <adamfla...@gmail.com> wrote:
> The amf error was recently fixed.. please update and give it a shot.
>
Reply all
Reply to author
Forward
0 new messages