« Return to Thread: Typed Objects from AS2 to .NET Assembly
by Ed Haack
::
Rate this Message:
Reply (Restricted by the Administrator) | Reply to Author | View in Thread
Sure thing… at this point
I’m either only going to recommend using Fluorine for simple, primitive
type remoting for my clients… I’d really appreciate the proj…
thanks
From:
fluorine-bounces@...
[mailto:fluorine-bounces@...] On Behalf Of Peter
Banfield
Sent: Saturday, March 22, 2008 10:38 PM
To: Fluorine Mailing List
Subject: Re: [Fluorine] Typed Objects from AS2 to .NET Assembly
Hi
Ed -
I'd be happy to send you an old project if you like. I'll need to pull out some
client related stuff though. It would require that you spend some time sorting
through my implementation to see what is different, but I know this project
works. Let me know.
Peter
Ed Haack <ed@...> wrote:
Thanks Peter, but I’ve
tried both of these as well… no dice. Placing the
“registerClass” in the object class itself is less clumsy.
I’ve worked with Flash
Remoting for years, but only the Macromedia implementation… I’d
really like to make the switch, and this is just an experiment with Fluorine.
I’ve looked at the PizzaService example code and what I’m doing is
no different.
I realize it’s been years
since most of the readers of this list have had to handle this… and that
Flash 8/AS2 has fallen out of vogue… but at its core, I’d hope that
Fluorine would still work for this setup.
I’ve even traced (via
ServiceCapture) the remoting request, which is just: Name: [parameter 1]
_name; Type: Fluorine.Stuff String; Value: Ed : and the
Response: Name: [result]; Type: null; Value: null
If you wanna test my code, the
gateway is: http://edhaack.net/fluorine/gateway.aspx
Again, thanks for any
constructive insight.
From:
fluorine-bounces@...
[mailto:fluorine-bounces@...] On Behalf Of Peter
Banfield
Sent: Saturday, March 22, 2008 9:06 PM
To: Fluorine Mailing List
Subject: Re: [Fluorine] Typed Objects from AS2 to .NET Assembly
Try
registering the class inside the value object's constructor rather than inside
your search command like so.
class com.search.SearchVO {
public function SearchVO(){
Object.registerClass("com.search.SearchVO", SearchVO);
}
}
Not really sure if that should make a difference. Also noticing that you aren't
using com.TheSilentGroup.Fluorine in your service. Although I'm not actually
sure why I've got that in my implementation as I don't see it being used.
Perhaps it just got left there at some point. It's been a couple years since
I've looked at this code.
Hope this helps.
Peter
Ed Haack <ed@...> wrote:
Thank you for your responses, and I have spent the last few
days pouring over the docs, and what I’m trying to do is send a custom
class object FROM Actionscript (via Flash 8/AS2) to a .NET Assembly (2.0).
Rather than talk theory, here’s my code:
AS2 Flash, Sample App – on the frame:
import
mx.remoting.Service;
import
mx.remoting.PendingCall;
import
mx.rpc.RelayResponder;
import
mx.rpc.ResultEvent;
import
Fluorine.Stuff;
Object.registerClass("Fluorine.Stuff",
Fluorine.Stuff);
var
stuff:Stuff = new Stuff();
stuff.Name
= "Ed";
var
remotingService:Service = new Service('http://localhost/fluorine/gateway.aspx',
null, 'Fluorine.FlashRemoting');
var
pc:PendingCall = remotingService.Hello(stuff);
pc.responder
= new RelayResponder(_root, "FlashRemoting_onSuccess",
"FlashRemoting_onFault");
function
FlashRemoting_onFault(fault)
{
trace("Error: " + fault.fault.faultstring);
}
function
FlashRemoting_onSuccess(re:ResultEvent)
{
trace("Success! : " + re.result);
}
============================
AS2
Custom/Object Class:
class
Fluorine.Stuff
{
private var _name:String;
public function get Name():String {return _name;}
public function set Name(param_name:String):Void {_name = param_name;}
public function Stuff(){}
}
============================
C#
Remoting Reception Class:
using
System;
namespace
Fluorine
{
public class FlashRemoting
{
public string Hello(Stuff
s)
{
return s.Name;
}
}
}
============================
C#
Custom/Object Class:
using
System;
namespace
Fluorine
{
public class
Stuff
{
private string
_name;
public string
Name
{
get { return
_name; }
set { _name = value;
}
}
public Stuff() {}
}
}
============================
Web.config:
<?xml version="1.0"?>
<configuration>
<appSettings/>
<connectionStrings/>
<system.web>
<compilation debug="true" />
<authentication mode="Windows" />
<httpModules>
<add name="FluorineGateway" type="com.TheSilentGroup.Fluorine.FluorineGateway,
com.TheSilentGroup.Fluorine"/>
</httpModules>
</system.web>
</configuration>
The
result is: “Success! : null”
Some
notes here…
Both
the AS and C# custom objects reside in the same namespace/package location.
Debugging
from the Visual Studio side, the name of the property come thru (both private
and public: _name and Name), but the value is null, on both.
Now,
with Macromedia’s Remoting the C# side would expect the type
“ASObject” and use reflection, then convert to the custom object.
I’m assuming this is done within Fluorine via the
“classMappings.”
I’m
beginning to think just sending primitives is the way to go, because when I
send an object, or strings, the remoting works as documented.
(BTW:
I’m not using Flex… flash.net.registerClassAlias doesn’t
apply here)
Please,
give this a try, and see if you don’t get the same results I have.
Any
insight would be very much appreciated… thanks folks
_______________________________________________
fluorine mailing list
fluorine@...
http://fluorine.thesilentgroup.com/mailman/listinfo/fluorine_fluorine.thesilentgroup.com
Looking
for last minute shopping deals? Find
them fast with Yahoo! Search.
_______________________________________________
fluorine mailing list
fluorine@...
http://fluorine.thesilentgroup.com/mailman/listinfo/fluorine_fluorine.thesilentgroup.com
Be
a better friend, newshound, and know-it-all with Yahoo! Mobile. Try
it now.
« Return to Thread: Typed Objects from AS2 to .NET Assembly
| Free Forum Powered by Nabble | Forum Help |