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