macromedia flash flash remoting:
I am new to flash remoting and am testing that remoting can interface
with my business services and objects for a project that I am
interested in. The problem is that although I can communicate with the
server on simple assembly service method calls, when i try to return an
array of objects, it says what the correct length is, but returns
"nothing" when i try to trace the values in the debugger! Some help
would be appreciated. I am making assembly calls on my c# .net service
with flash mx. Below is my code:
Client code
----------------------
import mx.remoting.Service;
import mx.rpc.RelayResponder;
import mx.rpc.FaultEvent;
import mx.rpc.ResultEvent;
import mx.remoting.PendingCall;
// fire up the output to the NetConnection debugger
mx.remoting.debug.NetDebug.initialize();
var newService = new Service("
http://192.168.1.100/gateway.aspx", null,
"FlashRemoting.RemotingExample.EchoTest", null, null);
var pc:PendingCall = newService.GetPeople();
pc.responder = new RelayResponder(this, "onRemotingResult",
"onRemotingFault" );
function onRemotingResult(re:ResultEvent):Void
{
mx.remoting.debug.NetDebug.trace({level:"None", message:"There was no
problem: " + re.result });
trace(re.result.length);
trace("re = "+re[i]);
for(var i=0; i < re.result.length; i++){
trace("event name = "+re.result[i].Name);
}//for
}
function onRemotingFault(fe:FaultEvent):Void
{
mx.remoting.debug.NetDebug.trace({level:"None", message:"There was a
problem: " + fe.fault.faultstring });
trace(fe.fault.faultstring);
}
And the Server code
-----------------------------
using System;
using FlashGateway.IO;
namespace FlashRemoting.RemotingExample
{
///
/// Summary description for Class1.
///
public class EchoTest
{
public EchoTest()
{
//
// TODO: Add constructor logic here
//
}
public string echoString(string s)
{
s += " , hello";
return s;
}
public Person[] GetPeople()
{
Person[] people = new Person[2];
Person person = new Person();
person.Name = "Jon";
people[0] = person;
person = new Person();
person.Name = "Dave";
people[1] = person;
return people;
}
}
}