View Full Version : Anyone have success with Flourine remoting for .NET
cellis3306
06-09-2007, 06:20 PM
Just wondering if anyone has used Flourine for .NET remoting,
or AMF.NET by openmymind,
or a custom NET Webservice/remoting codebase,
and if so do you have any source code, examples, etc to help me out? Thanks!
-Cameron
J_Miller
07-29-2007, 10:18 PM
Yes, I have had great success with Flourine. I had been using the full version from Macromedia, but recently switched to Flourine to be able to include in projects that couldnt support the $999 price tag. I will dig up some examples from my other machine and include in this thread in a bit.
J_Miller
07-30-2007, 03:37 AM
As promised, here are some example files using the Flourine .NET remoting gateway. I have included the FLA, AS2 Classes, VB.NET source, gateway.aspx, and web.config files. The commenting in the code is minimal, so I will break it all down here in this post. Sorry in advance to those who understand all this already, just figured I would try to go into a little detail for those trying to learn and get off the ground with this stuff.
Hope any of this helps!! -Jason
* NOTE - All source code has also been attached to this post for easier viewing. The FLA is in Flash 8 format. I have also included the remoting classes in the event you dont have the remoting components installed.
Create Remoting Manager (FLA):
Here we create a new instance of the RemotingManager by passing in the ServiceURL and the ServicePath. The ServiceURL is the URL to your gateway.aspx file located in the root of your web application. For mine running locally on my network it is: "http://192.168.1.106/gateway.aspx". The ServicePath in this case is a combination of the namespace of the VB.NET service and the name of the class that resides inside of it. So for this example it is: "remoting.example"....."remoting" being the namespace, and "example" being the class name.
import com.jasonmiller.data.RemotingManager;
var Remoting:RemotingManager = new RemotingManager("http://192.168.1.106/gateway.aspx", "remoting.example");
//
Create result handler functions (FLA):
Here we create an object with two functions in it for handling a successful response, as well as an error response. I am looping through the values and tracing out all the values sent back from the server, which in turn were all the values we sent to the server
var ResultHandler:Object = new Object();
ResultHandler.onResponse = function(Data:Object){
trace("REMOTING RESPONSE RECEIVED SUCCESSFULLY");
for (var a in Data.result){
if (a != "serviceName"){
trace("NAME: " + a + " --- VALUE: " + Data.result[a]);
}
}
}
ResponseHandler.onError = function(Data:Object){
trace("REMOTING ERROR RESPONSE RECEIVED");
for (var a in Data){
trace("NAME: " + a + " --- VALUE: " + Data[a]);
}
}
Make example remoting call (FLA):
First up we create an object that will contain all the parameters that we want to send to the server. We do it this way so that paramaters can be accessed using the same variable name on the server-side. In the make call function we pass the parameters in the following order:
1) name of the function we want to call on the server-side (String)
2) the params object (Object)
3) the scope in which we will handle results (Object)
4) the name of the function that will handle a successful response (String)
5) the name of the function that will handle an error response. (String)
var Params:Object = new Object();
Params.testValue1 = "HELLO, IM TEST VALUE ONE";
Params.testValue2 = "HELLO, IM TEST VALUE TWO";
Remoting.makeCall("exampleFunction", Params, ResultHandler, "onResponse", "onError");
//
VB.NET Service:
This service is setup to except parameters being sent from Flash, and send them all back to Flash in the response. This allows the example to run without the need for any database, but will show a the flow of data leaving and returning to Flash. You will notice that in .NET the parameters are being referred to as a HashTable. A HashTable in .NET is the equivalent of a object in ActionScript. This allows .NET to except whatever we sent to it, then turn around and send it right back to Flash preserving its data type in the result.
Imports System
Imports System.Collections
Namespace remoting
Class example
Public Function exampleFunction(ByVal Params As HashTable) As Hashtable
Dim resultObj As New HashTable
Dim Item As DictionaryEntry
For Each Item In Params
resultObj(Item.Key) = Item.Value
Next
Return resultObj
End Function
End Class
End Namespace
Web.Config File:
Nothing fancy going on here. Just making sure we include the Flourine Service DLL so that the .NET application will know what to do with our remoting calls.
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.web>
<httpModules>
<add name="FluorineGateway" type="com.TheSilentGroup.Fluorine.FluorineGateway, com.TheSilentGroup.Fluorine" />
</httpModules>
</system.web>
</configuration>
|
vBulletin® v3.8.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.