Blog to discuss Midnight Coders products features, ideas and trends in development of Rich Internet Applications

Tuesday, June 27, 2006

Flex Data Management Services for .NET - Part 3 (implementing Flex data updates in .NET)

Part 3 of the article describing an implementation of the ContactManager example is available. The part reviews the .NET code handling data change requests sent by Flex client. The client code can request adding new contact records, modifying or deleting existing ones.

The article is available here:
http://www.themidnightcoders.com/articles/datamanagement-part3.htm

Previous two installments are:

Part 1 - describes how to setup, compile and run the example locally
Part 2 - reviews the server-side C# code handling data fetching

Thursday, June 22, 2006

Invoking .NET objects with mx:RemoteObject

If you ever wondered how to invoke a .NET object using the mx:RemoteObject declaration, it can be done in just a few simple steps. This mini tutorial will guide through the setup and configuration:
  1. Download the latest beta of WebORB 2.1 (make sure not to downgrade to the Standard Edition - it does not have Flex integration)
  2. Deploy your .NET assembly with the class you will be invoking from Flex into WebORB. This can be done simply by copying the DLL into the /bin folder.
  3. Open WEB-INF\flex\flex-remoting-service.xml in a text editor and add a destination declaring your .NET type. Use the following format:

    <destination id="destination-name">
    <properties>
    <source>Your.Net.ClassName</source>
    </properties>
    </destination>
    where,
    • destination-name is an id assigned to your .NET class. The id will be used by Flex client when invoking server-side methods
    • Your.Net.ClassName full name of a .NET type exposed as a service to Flex clients

  4. Create a Flex Builder project as it is described in the "GETTING STARTED" section in the following article: http://www.themidnightcoders.com/articles/flextodotnet.htm
  5. Add the following remote object declaration to your MXML's application markup:
    <mx:RemoteObject id="remote-object-id"
    destination="destination-name"
    showbusycursor="true"
    fault="faultHandler(event)">
    <mx:method name="methodToInvoke"
    result="successHandler(event)">
    </mx:RemoteObject>
    where,
    • destination-name must be the same literal as destination id set in the server-side config
    • remote-object-id is an id used in the MXML application to refer to a remote object
    • methodToInvoke is the method name available in the remote destination that your remote object can invoke
    • successHandler and faultHandler are function references your MXML application will invoke upon successful or unsuccessful method invocation

  6. Suppose the following .NET class needs to be consumed by a Flex client:

    namespace weborb.tests
    {
    public class HelloWorld
    {
    public string sayHello()
    {
    return "Hey Flex";
    }
    }
    }
    then the destination declaration may look as the following:
    <destination id="helloWorld">
    <properties>
    <source>weborb.tests.HelloWorld</source>
    </properties>
    </destination>
    The <RemoteObject> declaration would have the following contents:

    <mx:RemoteObject id="helloWorldService"
    destination="helloWorld"
    showbusycursor="true"
    fault="faultHandler(event)">
    <mx:method name="sayHello"
    result="gotHello(event)">
    </mx:RemoteObject>
    The callback handler functions (gotHello and faultHandler) could be declared as:

    private function gotHello(event:ResultEvent):void
    {
    Alert.show("Server said: " + event.result, "Success");
    }

    private
    function faultHandler(event:FaultEvent):void
    {
    Alert.show(event.fault.faultstring, "Error");
    }

  7. Now anywhere in your MXML application you can invoke sayHello using the following line of code:

    helloWorldService.sayHello();

Wednesday, June 21, 2006

Flex Data Management Services for .NET - Part 2 (fetching data)

We just published Part 2 of the series. The second article describes the server-side implementation of the data fetching code of the ContactManager example.

You can access the article here. Part1 of the series is available here.

Tuesday, June 20, 2006

Flex Data Management Services for .NET - Part 1

We started a series of articles describing an implementation of Flex Data Management Services for .NET in WebORB. The first installment provides an overview of an example demonstrating basic data management operations on a .NET data source. The article describes how all the parts work together and walks through Flex Builder project setup. The next part will describe the back-end implementation and data delivery to a Flex client.

You can access the article here.

Monday, June 19, 2006

WebORB Beta 3 is released (includes Flex Data Services and RemoteObject for .NET)

We just released WebORB 2.1 Beta 3. The release includes support for Flex Data Services and RemoteObject for .NET. FDS support allows all basic CRUD operations against a .NET data source.

What can you do with Beta3:
  • Retrieve all or some data records from a data source (database, files, custom data collections)
  • Page through the data without writing any code (WebORB does paging)
  • Create, delete and update data in the original data source using the mx.data.DataService API
  • Deploy new services using the standard flex-remoting-service.xml configuration file
  • Deploy new data destination using the standard flex-data-service.xml configuration file
  • Throw application-level errors from a .NET code and catch them on the client side
One other important change in Beta 3 is it now used the .NET 2.0 installer.

Unfortunately, as with the previous betas, there is no documentation describing Flex integration, so there will be a set of tutorials describing the integration published to our website.

Friday, June 16, 2006

WebORB Enterprise

With the Flex integration work we have done, we decided to put all the flex-related functionality into a new edition of WebORB - WebORB Enterprise. The Enterprise edition will have all the features of the Standard and Professional editions as well as an implementation of Flex Data Services for .NET.

Pricing and licensing options for the WebORB Enterprise Edition will be announced soon.

This is just a heads-up - you cannot download the Enterprise edition yet. For now, if you are interested in evaluating FDS for .NET, please use the Professional Edition of WebORB (2.1 Beta) - it will have Flex integration until Enterprise is available.

Flex Data Services for .NET (WebORB 2.1 Beta 3)

We have started final testing and packaging for Beta 3 release of 2.1 The new release brings full CRUD (Create, Read, Update and Delete) capabilities to Flex applications working with a .NET backend. Client applications use exactly the same mx.data.DataService class to interface with the .NET backend data store as they would with the Adobe's Java implementation of FDS.

If you have downloaded and tried Flex Data Services for Java, you might be familiar with the Contact Manager application. The application demonstrates the use of all four basic database operations. Here's the same Flex application talking to a .NET backend through WebORB:

http://www.themidnightcoders.net/ContactSystem/ContactSystem.html

The client-side MXML is exactly the same as provided in the FDS distribution. The database is MS Access, but can be any other database that has a provider in .NET. We will be posting an article on our website describing how the example works.

Some additional things included in Beta 3 are:
  • Parsing of flex-remoting-service.xml - this removes the need to re-declare deployed services in the weborb configuration file
  • Parsing of flex-data-service.xml - weborb obtains information about deployed data destinations from the same configuration file used in the original FDS implementation
  • Hot deploy of the files listed above - the product detects any changes to the files and redeploys all the destinations and services
  • Support for conflict detection. If multiple users submit data queries that conflict with each other, the product will notify the users accordingly and will provide required information to resolve conflicts
The release should be available in the download section of our website shortly.

Saturday, June 10, 2006

WebORB and Flex Remoting for Ruby on Rails

We have been working on porting WebORB to Ruby. The end goal is to provide a 100% compatible AMF0 and AMF3 solution. On top of this we will offer an implementation of Flex Data Services for Ruby on Rails (as we do for .NET). Flash and Flex applications will be able to do remote method invocations against Ruby objects and do all kinds of data binding operations using the same client-side API available today.

One of the core tasks in the port is the AMF serialization/deserialization logic. Today we got very encouraging results after running our "Flash Remoting invocation test suite". The image below shows test results for Ruby object method invocations of with primitive arguments. There are still two failures, but the importance of successful invocations is huge! Notice the port number in the URL - you know it is Rails when you look at it!

Friday, June 02, 2006

Flex 2.0 online training

There is a fantastic online training course for Flex 2.0 coming up. The course consists of 10 training sessions every Friday starting on June 9th from 9AM to 1PM. The course is Breeze-based so all you need is a computer and an internet connection. You can get all the details here.