metamagpie
unread,Aug 7, 2009, 3:53:46 AM8/7/09Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
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!