Macromedia Flash Server - Basic Remoting Problem

This is Interesting: Free IT Magazines  
Home > Archive > Macromedia Flash Server > June 2005 > Basic Remoting Problem





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 Basic Remoting Problem
Merrill, Jason

2005-06-27, 5:45 pm

Hi all - first time here. Not a lot of luck on Flashcoders (but thanks
to those who tried if they are on this list), so I thought I would try
this list. I'm a Remoting virgin, (but not Actionscript) and I'm trying
to follow the HelloWorld application example in the LiveDocs, but am not
getting something right. My ColdFusion experience is minimal - I have
completed the Figleaf course and that's it. =20

So, the setup: I have a dynamic text field on the stage with an
instance name of "messageDisplay". The problem is the only thing I see
is in my trace
window:

6/24 17:56:37 [INFO] : Invoking helloWorld on remoteservices

And that's it. =20

The Code:

My ColdFusion component file is "HelloWorld.cfc" and only contains the
following:

<cfcomponent>
=09<cffunction name=3D"helloWorld" access=3D"remote">
=09 <cfreturn "Hello World">
=09</cffunction>
</cfcomponent>

I have tested this and other cfc and cfm files in the same location and
confirm they work in a browser. The URL on my local machine is:

http://localhost/com/macromedia/test/HelloWorld.cfc

I have installed the 2.0 remoting classes and components and have no
problems importing them. My Actionscript is in a file in the same
location as HelloWorld.cfc and is as follows:

import mx.remoting.Service;=20
import mx.services.Log;=20
import mx.rpc.RelayResponder;=20
import mx.rpc.FaultEvent;=20
import mx.rpc.ResultEvent;=20
import mx.remoting.PendingCall;=20
import mx.remoting.RecordSet;

// connect to service and create service object
var howdyService:Service =3D new
Service("http://localhost/com/macromedia/test/HelloWorld.cfc",
=09
new Log(),
=09
"remoteservices",
=09
null,=20
=09
null );

// call the service helloWorld() method
var pc:PendingCall =3D howdyService.helloWorld();

// tell the service what methods handle result and fault conditions
pc.responder =3D new RelayResponder( this, "helloWorld_Result",
"fault_Fault" ); =20

function helloWorld_Result(result:ResultEvent){
=09// display successful result
=09messageDisplay.text =3D flash.result;
=20 trace("helloWorld_Result called");
}
=09 =20
function fault_Fault(fault:FaultEvent){
=09//display fault returned from service
=09messageDisplay.text =3D fault.fault.faultstring;
}

Where have I erred? Thanks for any insight.

Jason Merrill | E-Learning Solutions | icfconsulting.com











NOTICE:
This message is for the designated recipient only and may contain privile=
ged or confidential information. If you have received it in error, please=
=20notify the sender immediately and delete the original. Any other use o=
f this e-mail by you is prohibited.

=-----------------------------------------------------------
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

JesterXL

2005-06-27, 5:45 pm

Add this up top:

NetDebug.initialize();

Then, open up your NetConnection Debugger, and tell us what it prints out.

----- Original Message -----
From: "Merrill, Jason" <JMerrill-xFcBdHuE1Uog9ELcbhaJlAC/G2K4zDHf@public.gmane.org>
To: <flashcomm-1Ss2GqJETD3yZ38Mhd3e/9ZfFG6BLHNm@public.gmane.org>
Sent: Monday, June 27, 2005 3:10 PM
Subject: [FlashComm] Basic Remoting Problem


Hi all - first time here. Not a lot of luck on Flashcoders (but thanks
to those who tried if they are on this list), so I thought I would try
this list. I'm a Remoting virgin, (but not Actionscript) and I'm trying
to follow the HelloWorld application example in the LiveDocs, but am not
getting something right. My ColdFusion experience is minimal - I have
completed the Figleaf course and that's it.

So, the setup: I have a dynamic text field on the stage with an
instance name of "messageDisplay". The problem is the only thing I see
is in my trace
window:

6/24 17:56:37 [INFO] : Invoking helloWorld on remoteservices

And that's it.

The Code:

My ColdFusion component file is "HelloWorld.cfc" and only contains the
following:

<cfcomponent>
<cffunction name="helloWorld" access="remote">
<cfreturn "Hello World">
</cffunction>
</cfcomponent>

I have tested this and other cfc and cfm files in the same location and
confirm they work in a browser. The URL on my local machine is:

http://localhost/com/macromedia/test/HelloWorld.cfc

I have installed the 2.0 remoting classes and components and have no
problems importing them. My Actionscript is in a file in the same
location as HelloWorld.cfc and is as follows:

import mx.remoting.Service;
import mx.services.Log;
import mx.rpc.RelayResponder;
import mx.rpc.FaultEvent;
import mx.rpc.ResultEvent;
import mx.remoting.PendingCall;
import mx.remoting.RecordSet;

// connect to service and create service object
var howdyService:Service = new
Service("http://localhost/com/macromedia/test/HelloWorld.cfc",

new Log(),

"remoteservices",

null,

null );

// call the service helloWorld() method
var pc:PendingCall = howdyService.helloWorld();

// tell the service what methods handle result and fault conditions
pc.responder = new RelayResponder( this, "helloWorld_Result",
"fault_Fault" );

function helloWorld_Result(result:ResultEvent){
// display successful result
messageDisplay.text = flash.result;
trace("helloWorld_Result called");
}

function fault_Fault(fault:FaultEvent){
//display fault returned from service
messageDisplay.text = fault.fault.faultstring;
}

Where have I erred? Thanks for any insight.

Jason Merrill | E-Learning Solutions | icfconsulting.com











NOTICE:
This message is for the designated recipient only and may contain privileged
or confidential information. If you have received it in error, please notify
the sender immediately and delete the original. Any other use of this e-mail
by you is prohibited.

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

Merrill, Jason

2005-06-27, 5:45 pm

Thanks=20

Ok - I feel stupid for asking, but where/how do I open my NetConnection
Debugger?

Jason Merrill | E-Learning Solutions | icfconsulting.com









[vbcol=seagreen]
out.[vbcol=seagreen]
thanks[vbcol=seagreen]
trying[vbcol=seagreen]
not[vbcol=seagreen]
and[vbcol=seagreen]
privileged[vbcol=seagreen]
notify[vbcol=seagreen]
e-mail[vbcol=seagreen]

=-----------------------------------------------------------
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

JesterXL

2005-06-27, 5:45 pm

A FLA must be open to do this.

Window > Other Panels > NetConnection Debugger

----- Original Message -----
From: "Merrill, Jason" <JMerrill-xFcBdHuE1Uog9ELcbhaJlAC/G2K4zDHf@public.gmane.org>
To: "FlashComm Mailing List" <flashcomm-1Ss2GqJETD3yZ38Mhd3e/9ZfFG6BLHNm@public.gmane.org>
Sent: Monday, June 27, 2005 3:16 PM
Subject: RE: [FlashComm] Basic Remoting Problem


Thanks

Ok - I feel stupid for asking, but where/how do I open my NetConnection
Debugger?

Jason Merrill | E-Learning Solutions | icfconsulting.com









[vbcol=seagreen]
out.[vbcol=seagreen]
thanks[vbcol=seagreen]
trying[vbcol=seagreen]
not[vbcol=seagreen]
and[vbcol=seagreen]
privileged[vbcol=seagreen]
notify[vbcol=seagreen]
e-mail[vbcol=seagreen]

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

Merrill, Jason

2005-06-27, 5:45 pm

Thanks - I never knew that panel existed. So I added
NetDebug.initialize(); right after my import statements, opened the
panel, and then tested the file in the IDE, but the panel didn't contain
any data. =20

Jason Merrill | E-Learning Solutions | icfconsulting.com









[vbcol=seagreen]
NetConnection[vbcol=seagreen]
prints[vbcol=seagreen]
try[vbcol=seagreen]
have[vbcol=seagreen]
see[vbcol=seagreen]
the[vbcol=seagreen]
please[vbcol=seagreen]
this[vbcol=seagreen]

=-----------------------------------------------------------
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

JesterXL

2005-06-27, 5:45 pm

Sorry cheif, I went and looked at your code; add this import up top:

import mx.remoting.debug.NetDebug;

----- Original Message -----
From: "Merrill, Jason" <JMerrill-xFcBdHuE1Uog9ELcbhaJlAC/G2K4zDHf@public.gmane.org>
To: "FlashComm Mailing List" <flashcomm-1Ss2GqJETD3yZ38Mhd3e/9ZfFG6BLHNm@public.gmane.org>
Sent: Monday, June 27, 2005 3:30 PM
Subject: RE: [FlashComm] Basic Remoting Problem


Thanks - I never knew that panel existed. So I added
NetDebug.initialize(); right after my import statements, opened the
panel, and then tested the file in the IDE, but the panel didn't contain
any data.

Jason Merrill | E-Learning Solutions | icfconsulting.com









[vbcol=seagreen]
NetConnection[vbcol=seagreen]
prints[vbcol=seagreen]
try[vbcol=seagreen]
have[vbcol=seagreen]
see[vbcol=seagreen]
the[vbcol=seagreen]
please[vbcol=seagreen]
this[vbcol=seagreen]

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

Merrill, Jason

2005-06-27, 5:45 pm

Thanks. Still nothing though. I think part of my problem is
understanding the gateway thing. This gives a type mismatch error:

var howdyService:Service =3D new
Service("http://localhost/flashservices/gateway/",
=09
"com.macromedia.HelloWorld.cfc",
new Log(),
"remoteservices",
null,=20
null );

Jason Merrill | E-Learning Solutions | icfconsulting.com









[vbcol=seagreen]
contain[vbcol=seagreen]
am[vbcol=seagreen]
location[vbcol=seagreen]
no[vbcol=seagreen]
conditions[vbcol=seagreen]

=-----------------------------------------------------------
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

Merrill, Jason

2005-06-27, 5:45 pm

Let me revise that - this doesn't give a type mismatch, but it also
doesn't trace anything other than "6/27 16:2:4 [INFO] : Invoking
helloWorld on com.macromedia.HelloWorld.cfc"

var howdyService:Service =3D new Service(
"http://localhost/flashservices/gateway/",
new Log(),
"com.macromedia.HelloWorld.cfc",
null,=20
null );

Jason Merrill | E-Learning Solutions | icfconsulting.com









[vbcol=seagreen]
would[vbcol=seagreen]
I'm[vbcol=seagreen]
but[vbcol=seagreen]
I[vbcol=seagreen]
I[vbcol=seagreen]
contains[vbcol=seagreen]
have[vbcol=seagreen]
same[vbcol=seagreen]
contain[vbcol=seagreen]

=-----------------------------------------------------------
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

Merrill, Jason

2005-06-27, 5:45 pm

OK - somehow I got the panel to work. Here is what I found:

MethodName: "/1/onStatus"
ResponseURI: (undefined)=20
Parameters (object #2)
......code: "Server.ResourceNotFound"
......description: "Service com.macromedia.HelloWorld.cfc not found."
......details: ""
......level: "error"
......type: ""

How does the path to the service work? I have my cfc in the following
location:

C:\CFusionMX7\wwwroot\com\macromedia\tes
t\HelloWorld.cfc

Where wwwroot is the root of my webserver.
C:\CFusionMX7\wwwroot\com\macromedia\tes
t\ is also the same location as
my Flash file.

Jason Merrill | E-Learning Solutions | icfconsulting.com









[vbcol=seagreen]
top:[vbcol=seagreen]
the[vbcol=seagreen]
[mailto:flashcomm-[vbcol=seagreen]
(but[vbcol=seagreen]
-[vbcol=seagreen]
an[vbcol=seagreen]
thing[vbcol=seagreen]
is:[vbcol=seagreen]
"helloWorld_Result",[vbcol=seagreen]
icfconsulting.com[vbcol=seagreen]
of[vbcol=seagreen]

=-----------------------------------------------------------
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

Patrick Mineault

2005-06-27, 5:45 pm

Take out the .cfc in new Service's second parameter.

Patrick Mineault
www.5etdemi.com
www.5etdemi.com/blog

Merrill, Jason wrote:

>OK - somehow I got the panel to work. Here is what I found:
>
>MethodName: "/1/onStatus"
>ResponseURI: (undefined)
>Parameters (object #2)
>.....code: "Server.ResourceNotFound"
>.....description: "Service com.macromedia.HelloWorld.cfc not found."
>.....details: ""
>.....level: "error"
>.....type: ""
>
>How does the path to the service work? I have my cfc in the following
>location:
>
> C:\CFusionMX7\wwwroot\com\macromedia\tes
t\HelloWorld.cfc
>
>Where wwwroot is the root of my webserver.
> C:\CFusionMX7\wwwroot\com\macromedia\tes
t\ is also the same location as
>my Flash file.
>
>Jason Merrill | E-Learning Solutions | icfconsulting.com
>
>
>
>
>
>
>
>
>
>
>
>
>top:
>
>
>the
>
>
>[mailto:flashcomm-
>
>
>(but
>
>
>-
>
>
>an
>
>
>thing
>
>
>is:
>
>
>icfconsulting.com
>
>
>of
>
>
>
>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

Merrill, Jason

2005-06-27, 5:45 pm

Now I finally get a result to show in my text field, but its an error:

CF Adapter: Service com.macromedia.HelloWorld does not have a method
"helloWorld" that matches the name and parameters provided.


The cfc file looks like this:

<cfcomponent>
<cffunction name=3D"helloWorld" access=3D"remote">
<cfreturn "Hello World">
</cffunction>
</cfcomponent>



Jason Merrill | E-Learning Solutions | icfconsulting.com









[vbcol=seagreen]
following[vbcol=seagreen]
as[vbcol=seagreen]
error:[vbcol=seagreen]
[mailto:flashcomm-[vbcol=seagreen]
didn't[vbcol=seagreen]
[mailto:flashcomm-[vbcol=seagreen]
<flashcomm-1Ss2GqJETD3yZ38Mhd3e/9ZfFG6BLHNm@public.gmane.org>[vbcol=seagreen]
icfconsulting.com[vbcol=seagreen]
it[vbcol=seagreen]
I[vbcol=seagreen]
and[vbcol=seagreen]
LiveDocs,[vbcol=seagreen]
minimal[vbcol=seagreen]
with[vbcol=seagreen]
remoteservices[vbcol=seagreen]
machine[vbcol=seagreen]
and[vbcol=seagreen]
the[vbcol=seagreen]
c",[vbcol=seagreen]
"helloWorld_Result",[vbcol=seagreen]
error,[vbcol=seagreen]
use[vbcol=seagreen]
-
-[vbcol=seagreen]
-
-[vbcol=seagreen]
[vbcol=seagreen]
[vbcol=seagreen]

=-----------------------------------------------------------
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-06-28, 7:45 am

I thought your CFC location was com.macromedia.test.HelloWorld? Why is the
error referring to com.macromedia.HelloWorld? Personally I'd do away with
all the subfolders, I usually stick my cfc's into wwwroot/sitename/cfc

Check your paths carefully. Also double check your spelling for
uppercase/lowercase errors. You are close.

Stefan





-----Original Message-----
From: flashcomm-bounces-1Ss2GqJETD3yZ38Mhd3e/9ZfFG6BLHNm@public.gmane.org
[mailto:flashcomm-bounces-1Ss2GqJETD3yZ38Mhd3e/9ZfFG6BLHNm@public.gmane.org] On Behalf Of Merrill, Jason
Sent: Monday, June 27, 2005 9:47 PM
To: FlashComm Mailing List
Subject: RE: [FlashComm] Basic Remoting Problem

Now I finally get a result to show in my text field, but its an error:

CF Adapter: Service com.macromedia.HelloWorld does not have a method
"helloWorld" that matches the name and parameters provided.


The cfc file looks like this:

<cfcomponent>
<cffunction name="helloWorld" access="remote">
<cfreturn "Hello World">
</cffunction>
</cfcomponent>



Jason Merrill | E-Learning Solutions | icfconsulting.com









[vbcol=seagreen]
following[vbcol=seagreen]
as[vbcol=seagreen]
error:[vbcol=seagreen]
[mailto:flashcomm-[vbcol=seagreen]
didn't[vbcol=seagreen]
[mailto:flashcomm-[vbcol=seagreen]
<flashcomm-1Ss2GqJETD3yZ38Mhd3e/9ZfFG6BLHNm@public.gmane.org>[vbcol=seagreen]
icfconsulting.com[vbcol=seagreen]
it[vbcol=seagreen]
I[vbcol=seagreen]
and[vbcol=seagreen]
LiveDocs,[vbcol=seagreen]
minimal[vbcol=seagreen]
with[vbcol=seagreen]
remoteservices[vbcol=seagreen]
machine[vbcol=seagreen]
and[vbcol=seagreen]
the[vbcol=seagreen]
c",[vbcol=seagreen]
"helloWorld_Result",[vbcol=seagreen]
error,[vbcol=seagreen]
use[vbcol=seagreen]
-[vbcol=seagreen]
-[vbcol=seagreen]

=---------------------------------------------------------
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

Merrill, Jason

2005-06-28, 5:45 pm

Thanks - I'll look into that and report back.

Jason Merrill | E-Learning Solutions | icfconsulting.com









[vbcol=seagreen]
the[vbcol=seagreen]
with[vbcol=seagreen]
Jason[vbcol=seagreen]
found."[vbcol=seagreen]
location[vbcol=seagreen]
also[vbcol=seagreen]
[mailto:flashcomm-[vbcol=seagreen]
"remoteservices",[vbcol=seagreen]
up[vbcol=seagreen]
<flashcomm-1Ss2GqJETD3yZ38Mhd3e/9ZfFG6BLHNm@public.gmane.org>[vbcol=seagreen]
opened[vbcol=seagreen]
icfconsulting.com[vbcol=seagreen]
what[vbcol=seagreen]
Flashcoders[vbcol=seagreen]
thought[vbcol=seagreen]
only[vbcol=seagreen]
<cfreturn[vbcol=seagreen]
same[vbcol=seagreen]
import[vbcol=seagreen]
cf[vbcol=seagreen]
pc:PendingCall[vbcol=seagreen]
archive:[vbcol=seagreen]
-
--[vbcol=seagreen]
-
--[vbcol=seagreen]
archive:[vbcol=seagreen]
-
-[vbcol=seagreen]
-
-[vbcol=seagreen]
[vbcol=seagreen]
[vbcol=seagreen]

=-----------------------------------------------------------
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

Merrill, Jason

2005-06-28, 5:45 pm

OK - got it mostly working now, thanks for everyone's help thus far - as
Stefan suggested, it was the path to the cfc. I'm so close now, HOWEVER
(and I know this will be an easy one, I just don't know where in the
docs this is explained), I'm still not able to retrieve the actual
value, even though my trace message says it received it. My trace
message says,=20

"helloWorld_Result called =20
6/28 10:54:12 [INFO] : com.macromedia.test.HelloWorld.helloWorld()
returned "Hello World"

The function is written as:

function helloWorld_Result(result:ResultEvent){
=09// display successful result
=09messageDisplay.text =3D flash.result; //how to get the value?
=09 //shows as "undefined"

=20 trace("helloWorld_Result called"); //this is called OK
}

The online example uses flash.result - but what is that? Is "flash"
some sort of actual object or just pseudocode? The LiveDocs example
does not make this clear. Result traces OK as [object Object] - but how
to get the actual string of the result?

Thanks for any help. =20

Jason Merrill | E-Learning Solutions | icfconsulting.com





NOTICE:
This message is for the designated recipient only and may contain privile=
ged or confidential information. If you have received it in error, please=
=20notify the sender immediately and delete the original. Any other use o=
f this e-mail by you is prohibited.

=-----------------------------------------------------------
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

Merrill, Jason

2005-06-28, 5:45 pm

Nevermind, got this working. Needed to change flash.result to
result.result

Thanks to everyone for their input.

Jason Merrill | E-Learning Solutions | icfconsulting.com









[vbcol=seagreen]
as[vbcol=seagreen]
HOWEVER[vbcol=seagreen]
how[vbcol=seagreen]
privileged or[vbcol=seagreen]
notify the sender[vbcol=seagreen]
you is[vbcol=seagreen]

=-----------------------------------------------------------
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