Flex + Cairngorm + WebOrb 2.0 Standard (Free) + .NET Sample Application / Tutorial
After my last tutorial/post about using JSON, Mark Piller from TheMidnightCoders commented that my requested functionality (Easily pass back client classes back and forth) could be completed using his product, WebOrb.NET. Thanks Mark!
After further investigation, I was still a little confused as how to accomplish this using a non-beta, standard (free) version of WebOrb.NET. Well, it turns out; WebOrb v2.0 works great with AMF0, the remoting format from Flash 8. This led me to Renaun’s RemoteObjectAMF0 which easily plugs into a Cairngorm ServiceLocator. So there’s the pieces, now to put together the puzzle.
First you will need the following for this tutorial: Visual Studio 2005, Adobe Flex Builder 2.0, Renaun’s RemoteObjectAMF0 (link), and Cairngorm (link).
Install WebOrb 2.0. Following all the system defaults should work just fine.
Open Visual Studio and Create a New Web Service: File -> New -> Website -> Empty Web Site.
Create a new C# Class: File -> New -> File -> Class -> Name the class EmployeeService.cs. You may be prompted about placing the cs file in the App_Code Folder, choose Yes.
A file EmployeeService.cs will be created in the App_Code Folder. Open EmployeeService.cs. Enter the following code.
[csharp]
using System;
using System.Web;
using Weborb.Util;
using net.shrefler.vo;
namespace net.shrefler.service
{
public class EmployeeService
{
public EmployeeService()
{
}
public EmployeeVO[] getEmployees()
{
EmployeeVO[] emps = new EmployeeVO[2];
EmployeeVO emp = new EmployeeVO();
emp.firstName = “Sam”;
emp.lastName = “Shrefler”;
emps[0] = emp;
emp = new EmployeeVO();
emp.firstName = “Your”;
emp.lastName = “Name”;
emps[1] = emp;
return emps;
}
}
}
[/csharp]
Create a new C# Class: File -> New -> File -> Class -> Name the class EmployeeVO.cs. You may be prompted about placing the cs file in the App_Code Folder, choose Yes.
A file EmployeeVO.cs will be created in the App_Code Folder. Open EmployeeVO.cs. Enter the following code.
[csharp]
using System;
using System.Web;
namespace net.shrefler.vo
{
public class EmployeeVO
{
public string firstName;
public string lastName;
public EmployeeVO()
{
}
}
}
[/csharp]
Next we’ll need to add WebOrb to our application. In your webroot folder should be a weborb directory. Copy “weborb.dll” from its bin directory into a bin directory in your new website. Then copy “weborb.config” and “web.config” from the weborb root directory to the root of your local website.
Open weborb.config and add the following code inside the
[xml]
[/xml]
Rather than describing all the flex code: I decided to just use the Source View. So here is the flex code: (link)
I hope this helps everyone as much as I hope it will help me. As always, comments are appreciated. Good Luck!

Yeah dude! Thanks for the postings, it looks like you in the same boat that I’m in…
My company has a .NET system in place and I’m looking to produce client data apps in flex!
I used to run remoting components for flash2 but have found that actionscript3 has built in remoting components that are simular but missing function…
I find that fluorine works alot like the remoting components, but I’m looking for a way to access .NET assemblies from Actionscript 3… I’ve tried everything I can pice together and still no luck… I think you expressed some sucess with flex and fluorine, got any examples?
Basicly all I need to do is access .Net assemblies from flex…
Thanks Sam…
– Sidsevensix
Hai ,
Is it possible to use WebORB + DotNet + Flex builder 2.0 without data services .
Thanks in Advance.
Regards,
Mahendhiran.K
Hi,
Your article was very useful and I could access the .NET data using Actionscript.
I want to know how to send the Flex data to the .NET application?
I dont want to use a seperate HTTP service to pass data back to the server.
Please help.
Thanks,
JG Giridhar
Greatest tutorial, Sam! I thing your article is easy to follow and wow made its work for me. I can’t wait for your next article about sending data to Fluorine. It will be please, if you don’t mind to notify me about that post.
Thanks for great job.
How do I get things up and running? I am learning Flex with Builder 3 and there are compiling errors after loading the source into a new Flex project created from there.
Also, do I just copy the SWC file into the folder? for the reference of Renaun’s RemoteObjectAMF0 (link), and Cairngorm (link).
i want to ask, how can i download a weborb.dll from the web. or the file have the orther name. thanks
commas
Hi,
My name’s Alan. Thank’s for the example. The problem’s that I can’t access the Flex source code. Where can I find it ?
Thank’s
Alan