I do have serious problems...
For quite a long time I am trying to connect some Enterprise JavaBeans to a
FlashMovie. The idea was to combine a great FrontEnd and a great BackEnd.
The problem is, I can't get it work.
I bought a copy of FlashMX2004 and installed the RemotingComponents (from
http://www.macromedia.com/software/flashremoting/downloads/components ).
I wrote Enterprise JavaBeans that work well, they are deployed on a JBoss
Server and a TestServlet shows me, that everything is okay and acts (answers)
like it should.
I searched the web and got quite litte information (EJB seems to be not too
popular with FlashRemoting) and about none concerning FlashMX2004.
I deployed the Gateway and can connect to it.
In a looong list of errors I fought my way through the very little delved and
barely penetrable jungle to what I call my final frontier.
When I run my move, I get connected to my EJB (Home Interface with
getService(myJNDI)) and even get an object when calling myEJB.create(). But
when I try doing anything with that, Flash does nothing. No request, no answer,
the NetConnection Debugger shows neither call nor answer.
I try to call the makeSomeNoise() Method which should give a simple String
back.
Sorry for telling my whole story, but I'm quite frustrated by now.
Any suggestion for emprovement strongly appreciated!
However, here is my code...
FRAME1:[Q]#include "NetServices.as"
#include "NetDebug.as"
var myURL:String = "http://localhost:8080/flashgateway/gateway";
var myEJB:String = "ejb/foo/facade/Entry";
var textCon:String = new String();
var createRes:Object = new Object();
_global.System.onStatus = createRes.onStatus;
EJBtext.text = "soon...";
// connection stuff
function init() {
// Gateway
NetServices.setDefaultGatewayUrl(myURL);
var myGateway:Object = NetServices.createGatewayConnection();
// BeanInstance
EntryBean = myGateway.getService(myEJB);
if (EntryBean != null) {
textCon = "Connection Established\nEntryBean:" + EntryBean;
EntryBean.create(createRes);
} else {
EJBtext.text = "Cannot connect to server.";
}
}
createRes.onResult = function (resData:Object):Void {
EntryEJB = resData;
EJBtext.text = textCon + "\n\nGot Bean Instance.\nEntryEJB: " + EntryEJB;
}
createRes.onStatus = function (resData:Object):Void {
EJBtext.text = textCon + "\ncreate() - STATUS: \n" + resData.description;
}
init();
stop();[/Q]
FRAME2:[Q]var noiseRes:Object = new Object();
_global.System.onStatus = noiseRes.onStatus;
// Resulthandler
noiseRes.onResult = function (resData:Object):Void {
EJBtext.text = "makeSomeNoise() works!\n" + resData;
}
noiseRes.onStatus = function (resData:Object):Void {
EJBtext.text = "makeSomeNoise() sucks.\n" + resData.description;
}
EntryEJB.makeSomeNoise(noiseRes);
stop();[/Q][num]s[/num][bullet]sd[/bullet][bullet]d[/bullet]