Mailing List
Home
Forum Home
Flash Pro
Subjects
Subject: RE: Firework Effect
Web Service Results
Flash Interface with 10mb xml file
AW: [Flashcoders] Switch/Case vs If/else
AW: [Flashcoders] Switch/Case vs If/else
Flash MX 2004 Sucks
Reading and displaying RSS feeds in Flash MX
Flash and QuickTime VR
Textfield prototype question
XML to Object help
Order of events per frame
MX2004 Dataset itemClassName
memory management removeMovieClip /
Event Dispatcher between classes
Help: MX 2004 How to script a print button to print the entire sli
ScrollPane component doesn 't auto update
setInterval bug identified and fixed
setInterval bug identified and fixed
Listener Object 's best practice
 
FlashRemoting w/FlashMX2004 and EJB... really working?

FlashRemoting w/FlashMX2004 and EJB... really working?

2004-04-19       - By KingKarsten

 Back
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:
#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();



FRAME2:
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();



-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- --
Server geeks, take heart! If you're sick of wading through
animation & graphics instruction for relevant info., then
Nate Weiss' Macromedia Flash MX Professional 2004 for Server
Geeks is for you. Leave designing to designers and dig into
core concepts to create rich user interfaces, online
advertising, and more.  See www.peachpit.com for more info.
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/FLASHmacromedia/

<*> To unsubscribe from this group, send an email to:
    FLASHmacromedia-unsubscribe@(protected)

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/