Macromedia Flash Server - Serverside Remoting

This is Interesting: Free IT Magazines  
Home > Archive > Macromedia Flash Server > May 2005 > Serverside Remoting





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Serverside Remoting
Stefan Richter

2005-05-04, 7:45 am

Hi,
I have a class on my server which writes a log when the session ends.
Everything works fine, the chatlog gets passed and is received by the CFC
and then written to the DB.

When the Remoting call happens I see this in my app inspector which tells me
that all is good:

NetServices info 1: logChatSession_Result was received from server:
who[NetServices] severity[info] number[1] meesage[logChatSession_Result was
received from server: ]

The Remoting call happens like this inside my ChatLogger class:

ChatLogger.prototype.saveLog = function(adminid, clientid){
// grab the chat history from a SO
var slot = this.log_so.getProperty(adminid + "_" + clientid);
trace("## ChatLogger: writing log " + slot);

logChatSession_Result = function(res){
trace("logOK: " + res); // <<< I never see this trace
}
// write to DB via Remoting
this.logging_service.logChatSession(slot);
};

The only part that I don't see is the logChatSession_Result. It never fires.
Is this a scope issue? I also tried using a responder Object with onResult
and while the logging still worked fine I never see the _Result.
Again, this is all serverside and I am not too familiar with it.

Any hints?

Thanks

Stefan



=-----------------------------------------------------------
Supported by Fig Leaf Software - http://www.figleaf.com
=-----------------------------------------------------------

To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcomm

Dirk Eismann

2005-05-04, 7:45 am

Indeed this seems to be a scoping issue.

What parameters are you passing to the NetServiceProxy constructor and =
where do you instantiate it?

Dirk.

> -----Original Message-----
> From: flashcomm-bounces-1Ss2GqJETD3yZ38Mhd3e/9ZfFG6BLHNm@public.gmane.org
> [mailto:flashcomm-bounces-1Ss2GqJETD3yZ38Mhd3e/9ZfFG6BLHNm@public.gmane.org]On Behalf Of Stefan
> Richter
> Sent: Wednesday, May 04, 2005 12:33 PM
> To: 'FlashComm Mailing List'
> Subject: [FlashComm] Serverside Remoting
>=20
>=20
> Hi,
> I have a class on my server which writes a log when the session ends.
> Everything works fine, the chatlog gets passed and is=20
> received by the CFC
> and then written to the DB.
>=20
> When the Remoting call happens I see this in my app inspector=20
> which tells me
> that all is good:
>=20
> NetServices info 1: logChatSession_Result was received from server:=20
> who[NetServices] severity[info] number[1]=20
> meesage[logChatSession_Result was
> received from server: ]=20
>=20
> The Remoting call happens like this inside my ChatLogger class:
>=20
> ChatLogger.prototype.saveLog =3D function(adminid, clientid){=09
> // grab the chat history from a SO
> var slot =3D this.log_so.getProperty(adminid + "_" + clientid);=09
> trace("## ChatLogger: writing log " + slot);
> =09
> logChatSession_Result =3D function(res){
> trace("logOK: " + res); // <<< I never see this trace
> }=09
> // write to DB via Remoting
> this.logging_service.logChatSession(slot);
> };
>=20
> The only part that I don't see is the logChatSession_Result.=20
> It never fires.
> Is this a scope issue? I also tried using a responder Object=20
> with onResult
> and while the logging still worked fine I never see the _Result.
> Again, this is all serverside and I am not too familiar with it.
>=20
> Any hints?
>=20
> Thanks
>=20
> Stefan
>=20
>=20
>=20
> =3D-----------------------------------------------------------
> Supported by Fig Leaf Software - http://www.figleaf.com
> =3D-----------------------------------------------------------
>=20
> To change your subscription options or search the archive:
> http://chattyfig.figleaf.com/mailman/listinfo/flashcomm
>=20


=-----------------------------------------------------------
Supported by Fig Leaf Software - http://www.figleaf.com
=-----------------------------------------------------------

To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcomm

Stefan Richter

2005-05-04, 5:45 pm

Thanks for the reply.

I have my main.asc and in there I create my ChatLogger like this inside the
application scope:

Application.onAppStart = function(){
this.logger = new ChatLogger("chatlog");

this.logger.setFlashRemoting("http://mysite.com/flashservices/gateway",
cfc.correspondent_logger");
}

Inside ChatLogger I have this:

ChatLogger.prototype.setFlashRemoting = function(url, service_name) {
trace("## ChatLogger: remoting set up");
NetServices.setDefaultGatewayUrl(url);
this.nc = NetServices.createGatewayConnection();
this.logging_service = this.nc.getService(service_name, this);
};

There's nothing of significance in my constructor.


The remoting call is then made as

ChatLogger.prototype.saveLog = function(adminid, clientid){
// grab the chat history from a SO
var slot = this.log_so.getProperty(adminid + "_" + clientid);
trace("## ChatLogger: writing log " + slot);

logChatSession_Result = function(res){
trace("logOK: " + res); // <<< I never see this trace
}
// write to DB via Remoting
this.logging_service.logChatSession(slot);
};

Any errors you can see? Do I maybe have to move logChatSession_Result
outside of the prototype? Sorry, I have no clue...

Stefan





> -----Original Message-----
> From: flashcomm-bounces-1Ss2GqJETD3yZ38Mhd3e/9ZfFG6BLHNm@public.gmane.org
> [mailto:flashcomm-bounces-1Ss2GqJETD3yZ38Mhd3e/9ZfFG6BLHNm@public.gmane.org] On Behalf Of
> Dirk Eismann
> Sent: 04 May 2005 13:59
> To: FlashComm Mailing List
> Subject: RE: [FlashComm] Serverside Remoting
>
> Indeed this seems to be a scoping issue.
>
> What parameters are you passing to the NetServiceProxy
> constructor and where do you instantiate it?
>
> Dirk.
>
> session ends.
> received by the
>
> =---------------------------------------------------------
> Supported by Fig Leaf Software - http://www.figleaf.com
> =---------------------------------------------------------
>
> To change your subscription options or search the archive:
> http://chattyfig.figleaf.com/mailman/listinfo/flashcomm
>



=-----------------------------------------------------------
Supported by Fig Leaf Software - http://www.figleaf.com
=-----------------------------------------------------------

To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcomm

Dirk Eismann

2005-05-04, 5:45 pm

I haven't used Flash Remoting with FCS for quite a while so I may be =
wrong, but inside your code you do:

this.logging_service =3D this.nc.getService(service_name, this);

So you're passing a reference to 'this' to the getService() method. =
Callbacks from Flash Remoting will be routed to 'this' (i.e. to your =
ChatLogger class)

Just add the result handler to the protoytpe of ChatLogger and you =
should be fine, i.e.

ChatLogger.prototype.logChatSession_Result =3D function(result) {
trace("Result!");
}

Dirk.

> -----Original Message-----
> From: flashcomm-bounces-1Ss2GqJETD3yZ38Mhd3e/9ZfFG6BLHNm@public.gmane.org
> [mailto:flashcomm-bounces-1Ss2GqJETD3yZ38Mhd3e/9ZfFG6BLHNm@public.gmane.org]On Behalf Of Stefan
> Richter
> Sent: Wednesday, May 04, 2005 3:16 PM
> To: 'FlashComm Mailing List'
> Subject: RE: [FlashComm] Serverside Remoting
>=20
>=20
> Thanks for the reply.
>=20
> I have my main.asc and in there I create my ChatLogger like=20
> this inside the
> application scope:
>=20
> Application.onAppStart =3D function(){
> this.logger =3D new ChatLogger("chatlog");
> =09
> this.logger.setFlashRemoting("http://mysite.com/flashservices/
> gateway",
> cfc.correspondent_logger");=09
> }
>=20
> Inside ChatLogger I have this:
>=20
> ChatLogger.prototype.setFlashRemoting =3D function(url, service_name) =

{
> trace("## ChatLogger: remoting set up");
> NetServices.setDefaultGatewayUrl(url);
> this.nc =3D NetServices.createGatewayConnection();
> this.logging_service =3D this.nc.getService(service_name, this);
> };
>=20
> There's nothing of significance in my constructor.
>=20
>=20
> The remoting call is then made as=20
>=20
> ChatLogger.prototype.saveLog =3D function(adminid, clientid){=09
> // grab the chat history from a SO
> var slot =3D this.log_so.getProperty(adminid + "_" + clientid);=09
> trace("## ChatLogger: writing log " + slot);
> =09
> logChatSession_Result =3D function(res){
> trace("logOK: " + res); // <<< I never see this trace=20
> }=09
> // write to DB via Remoting =09
> this.logging_service.logChatSession(slot);
> };
>=20
> Any errors you can see? Do I maybe have to move logChatSession_Result
> outside of the prototype? Sorry, I have no clue...
>=20
> Stefan
>=20
>=20
>=20
> =20
>=20
> Of Stefan=20
> inspector which=20
> from server:=20
>=20
>=20
> =3D-----------------------------------------------------------
> Supported by Fig Leaf Software - http://www.figleaf.com
> =3D-----------------------------------------------------------
>=20
> To change your subscription options or search the archive:
> http://chattyfig.figleaf.com/mailman/listinfo/flashcomm
>=20


=-----------------------------------------------------------
Supported by Fig Leaf Software - http://www.figleaf.com
=-----------------------------------------------------------

To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcomm

Stefan Richter

2005-05-04, 5:45 pm

Thanks Dirk, I'll try that



> -----Original Message-----
> From: flashcomm-bounces-1Ss2GqJETD3yZ38Mhd3e/9ZfFG6BLHNm@public.gmane.org
> [mailto:flashcomm-bounces-1Ss2GqJETD3yZ38Mhd3e/9ZfFG6BLHNm@public.gmane.org] On Behalf Of
> Dirk Eismann
> Sent: 04 May 2005 14:28
> To: FlashComm Mailing List
> Subject: RE: [FlashComm] Serverside Remoting
>
> I haven't used Flash Remoting with FCS for quite a while so I
> may be wrong, but inside your code you do:
>
> this.logging_service = this.nc.getService(service_name, this);
>
> So you're passing a reference to 'this' to the getService()
> method. Callbacks from Flash Remoting will be routed to
> 'this' (i.e. to your ChatLogger class)
>
> Just add the result handler to the protoytpe of ChatLogger
> and you should be fine, i.e.
>
> ChatLogger.prototype.logChatSession_Result = function(result) {
> trace("Result!");
> }
>
> Dirk.
>
> service_name) {
> this); };
> logChatSession_Result
> Behalf Of Dirk
> constructor
> "_" + clientid);
> see this trace
> Object with
> never see the
>
> =---------------------------------------------------------
> Supported by Fig Leaf Software - http://www.figleaf.com
> =---------------------------------------------------------
>
> To change your subscription options or search the archive:
> http://chattyfig.figleaf.com/mailman/listinfo/flashcomm
>



=-----------------------------------------------------------
Supported by Fig Leaf Software - http://www.figleaf.com
=-----------------------------------------------------------

To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcomm

Stefan Richter

2005-05-04, 5:45 pm

That worked great, many thanks!



> -----Original Message-----
> From: flashcomm-bounces-1Ss2GqJETD3yZ38Mhd3e/9ZfFG6BLHNm@public.gmane.org
> [mailto:flashcomm-bounces-1Ss2GqJETD3yZ38Mhd3e/9ZfFG6BLHNm@public.gmane.org] On Behalf Of
> Stefan Richter
> Sent: 04 May 2005 14:55
> To: 'FlashComm Mailing List'
> Subject: RE: [FlashComm] Serverside Remoting
>
> Thanks Dirk, I'll try that
>
>
>
> I may be
> (i.e. to your
> Of Stefan
> ChatLogger class:
> familiar with it.
>
>
> =-----------------------------------------------------------
> Supported by Fig Leaf Software - http://www.figleaf.com
> =-----------------------------------------------------------
>
> To change your subscription options or search the archive:
> http://chattyfig.figleaf.com/mailman/listinfo/flashcomm
>



=-----------------------------------------------------------
Supported by Fig Leaf Software - http://www.figleaf.com
=-----------------------------------------------------------

To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcomm

Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com