all groups > macromedia flash flash remoting > april 2006 >
You're in the

macromedia flash flash remoting

group:

helloWorld troubles


helloWorld troubles j_mcwatters
4/25/2006 12:00:00 AM
macromedia flash flash remoting:
Hello World!

Well at least that worked.

I'm trying to follow the "Building a Hello World application with Flash
Remoting" example at
http://livedocs.macromedia.com/flashremoting/mx2004/using_flash_remoting/wwhelp/
wwhimpl/js/html/wwhelp.htm.

I've followed it to the letter, but nothing is appearing in my text field.
I have dragged both the remoting and remotingDebugging classes onto the stage,
and I am using the following actionscript :

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;
import mx.remoting.debug.NetDebug;
NetDebug.initialize();


// connect to service and create service object
var howdyService:Service = new Service(
"http://localhost:8500/flashservices/gateway",
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",
"serviceFunctionName_Fault" );

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

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


I do have a dynamic text field named messageDisplay on the stage.

When I run my movie, the output says, "4/19 7:47:42 : Invoking helloWorld on
remoteservices"
and my NetConnection Debugger lists 4 events.

#1) Connect - Summary: ConnectString:
"http://localhost:8500/flashservices/gateway"
Details: ConnectString:
"http://localhost:8500/flashservices/gateway"
DebugId: "0"
EventType: "Connect"
MovieUrl:
"file:///C|/CFusionMX7/wwwroot/CFIDE/DEV/FlashRemoting/MX2004/serviceTest.swf"
Protocol: "http"
Source: "Client"
Time: 1145404542873
Date (object #1)
....."Wed Apr 19 07:55:42 GMT+0800 2006"

#2) Call - Summary: MethodName: "remoteservices.helloWorld"
Parameters (object #2)
.....No properties
Details: DebugId: "0"
EventType: "Call"
MethodName: "remoteservices.helloWorld"
MovieUrl:
"file:///C|/CFusionMX7/wwwroot/CFIDE/DEV/FlashRemoting/MX2004/serviceTest.swf"
Protocol: "http"
Source: "Client"
Time: 1145404542883
Date (object #1)
....."Wed Apr 19 07:55:42 GMT+0800 2006"
Parameters (object #2)
.....No properties

#3 AmfStatusCall - Summary: MethodName: "/1/onStatus"
ResponseURI: (undefined)
Parameters (object #2)
.....code: "Server.ResourceNotFound"
.....description: "Service remoteservices not found."
.....details: ""
.....level: "error"
.....type: ""

Details: EventType: "AmfStatusCall"
MethodName: "/1/onStatus"
ResponseURI: (undefined)
Source: "Server"
Time: 1145404544756
DebugId: "0"
MovieUrl:
"file:///C|/CFusionMX7/wwwroot/CFIDE/DEV/FlashRemoting/MX2004/serviceTest.swf"
Protocol: "http"
Date (object #1)
....."Wed Apr 19 07:55:44 GMT+0800 2006"
Parameters (object #2)
.....code: "Server.ResourceNotFound"
.....description: "Service remoteservices not found."
.....details: ""
.....level: "error"
.....type: ""

#4 Status - Summary: Status (object #2)
.....code: "Server.ResourceNotFound"
.....description: "Service remoteservices not found."
.....details: ""
.....level: "error"
.....type: ""
Details: DebugId: "0"
EventType: "Status"
MovieUrl:
"file:///C|/CFusionMX7/wwwroot/CFIDE/DEV/FlashRemoting/MX2004/serviceTest.swf"
Protocol: "http"
Source: "Client"
Time: 1145404544986
Date (object #1)
....."Wed Apr 19 07:55:44 GMT+0800 2006"
Status (object #2)
.....code: "Server.ResourceNotFound"
.....description: "Service remoteservices not found."
.....details: ""
.....level: "error"
.....type: ""


My folder structure is as follows, serviceTest.fla and serviceTest.swf are
at the root. There is a subfolder called "remoteservices" and in that folder is
the file called helloWorld.cfm.

I'm sorry for the length of this reply, but I really want to learn this stuff
and I have been struggling for a couple days on just this.
If anyone could lend a hand or advice, I would be really greatful.

- J
Re: helloWorld troubles j_mcwatters
4/25/2006 12:32:43 PM
Hello again,

I've figured out what I did wrong. I didn't realize, even though I had read
it, that the path to the service name had to be absolute from the wwwroot
folder of coldFusion. I had thought it could be relative to the swf that was
calling the service. Ooops.

In this case the attribute "remoteservices" should have been
"subfolder.subfolder.remoteservices" as my project resides two levels down from
the wwwroot dir.

So there you go.

- J
AddThis Social Bookmark Button