Flex Remoting and .NET with WebORB


Adobe Flex is the leading technology in the industry for developing Rich Internet Applications. Adobe Flex applications run on the Flash Player which is a browser plug-in. Flash player has a penetration of 98% on the modern day browsers. Normally building a web application with Adobe Flex on the client side and .NET on the server side using webservice as a medium for the communication is very much possible.

Rather than accessing SOAP services, accessing remote objects from the server is even more powerful, fast and robust way of communicating the client to the server. Binary communication between the Flex client and .NET happens using AMF (Action message format) which is a binary protocol published by Adobe. AMF is a binary format used to serialize ActionScript objects. It is used primarily to exchange data between an Adobe Flash application and a remote service, usually over the Internet. Some of the notable advantages of AMF are:

  • AMF Objects are very small using zlib.
  • Fast serialization/de-serialization of objects.
  • Native Types and Custom classes supported.

(Source:Ted On Flash)

Now to make the AMF communication complete with the Flex client and any sever side technology there is the need for a runtime environment which facilitates the transfer of objects from client to server and vice versa. This is where WebORB for .NET comes into play. WebORB is the presentation server from MidnightCoders which effortlessly connects client side technologies like Flex/Flash/Ajax/Silverlight with .NET Objects, XML webservices and rich media streams. WebORB can plug in to any ASP.NET application and can expose its object to client side technologies.

Configuring WebORB for .NET

The developer edition of this product is available for free which gives connection limit for 5 IPs. The setup can be downloaded from the WebORB website. WebORB for .NET version is the stable version available for download.

IIS and .NET framework are the prerequisites before we start installation of WebORB developer edition. In the download select and run the exe to install webORB

Once installation of WebORB is completed, the physical location of the installation will be the /Inetpub/wwwroot/weborb30 which will ideally correspond to the http://locahost/weborb30 path.weborb_installation_default_location

Creating a basic Flex and .NET Remoting Application

Developing a .NET Class

Start off with developing a simple .NET class named Employee which has some variables and a function getEmployeeList() which will be accessed by the client side to retrieve an array of objects.netClass

Deploying a .NET DLL

Once the development of the .NET project is completed and published. Place the DLL file of the project into Inetpub\wwwroot\weborb30\bin directory. In this example the EmployeeWebOrb.dll should be put into the bin directory.

After deploying the DLL, by accessing the management tab inside the webORB console (http://localhost/weborb30/weborbconsole.html) it is possible to check if the server side code is working properly.
Go to Management -> Services tab where the list of deployed DLLs will be available:list_of_deployed_dlls

As per the example in this article, EmployeeWebOrb.dll is available in the deployed assemblies list. Select the EmployeeWebOrb.dll. Go into the DLL file and select the getEmployeeList()invoke

Now click on the invoke button on the right hand side. All the values that are returned by getEmployeList() is displayed along with invocation duration which in this case is 33 millisecond. The Services inside the management console is an effective tool for the developers to check the values returned from the server side code and eventually enables fewer chances of server integration problems.

There is also a code generator section available which will create the client side business logic code for the developer.getEmployeeList

Developing a Flex application

Client side application’s logic for this example is very straight-forward. First create a flex project WebORBFlex. The mx:RemoteObject is the server-side component in the flex code that connects with the webORB to get data from the server side. The GenericDestination value provided for the property, destination is the destination of the service. This value should match to the destination entry in remoting-config.xml inside Inetpub\wwwroot\weborb30\WEB-INF\flex. The source property accepts the .Net class name that is being accessed and endpoint points the application to look for the RemoteObject destination.flexApplication

Deploying Flex

Deploy the flex output to the server inside Inetpub\wwwroot\weborb30\. Open the WebORBFlex.html. You should have a working Flex application using Flex Remoting with .NET.flexApp_working

Other key features of WebORB

    • MultiClient support: WebORB can be used with other client side technology like Silverlight, Ajax, Flash etc.
    • Real time messaging: data push, producer-consumer model, MSMQ integration, remote shared objects, message broadcast.
    • Video Streaming: Streaming flash video, video broadcast, server initiated video, video recording, video chat.
    • Data Management: Code generators, full CRUD operations, client synchronization, intuitive API, extensible programming model, sample test drive.
    • Performance Monitoring:Server-side performance instrumentation.

(Source: Midnight Coders)

Happy programming!!!

Gateway Technolabs

Gateway Technolabs

Marketing & Communication Department at Gateway TechnoLabs Pvt. Ltd.
SINCE 1997.
Gateway Technolabs

Published by

Gateway Technolabs


Leave a Reply

Your email address will not be published. Required fields are marked *