Flex Data Services for .NET with WebORB
Part 1 - Setup
Search:
home / articles / flex integration  

Flex Data Management Services for .NET
This article describes an implementation of Flex Data Management Services in WebORB for .NET. The article consists of four parts. Part 1 (this document) introduces an example demonstrating usage of data management operations in .NET from a Flex application. Part 1 consists of the following sections:

Part 2 of the article reviews the server-side code responsible for reading and returning data to the client. Parts 3-4 will describe data synchronization code and review the client-side of the application.

Part 3 of the article reviews the code handling data updates in the server-side.

If you have any comments about the article, or have any questions about the product and the integration of Flex Data Management Services in WebORB, post them to the WebORB interest group at: http://groups.yahoo.com/group/flashorb/

INTRODUCTION
WebORB 2.1 introduces support for Flex Data Management Services for .NET. The product provides a seamless integration with the Flex client-side data services component. Using WebORB Flex applications can retrieve data from .NET data sources (in bulk or paged), submit updates, create or delete records and automatically synchronize changes between a client and the server.

WebORB does not require Flex Data Services, however it is important to download FDS, as it provides access to the client-side component containing the client-side mx.data API.

The server-side data management API in WebORB is very similar to the one provided by FDS. This guide walks through an example demonstrating all four basic database operations commonly known as CRUD (Create, Read, Update, Delete). You can see the finished example at:

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

OVERVIEW

In order to create and run the example shown above you will need to download and install the following software:

The diagram below provides an overview of how all the parts of the example work together. The architecture is demonstrative of most Flex data-driven application.

A solution consists of the following modules:

  • WebORB - provides an implementation of Flex Data Services for .NET. It manages a collection of destinations. WebORB contains the logic for interpreting client requests, executing autonomous data management operations and updating connected clients with the changes occurred in the data source.
     

  • Data destination - represents an executable unit targeted by client application to execute data management operations. Normally a data destination is represented by a .NET class implementing Assembler interface or exposing methods to retrieve, create, update or delete data in a data source.
     

  • Data adapter - an object tying together WebORB's FDS logic and a data destination. An adapter must implement WebORB data adapter interface. The product provides a default implementation, but allows registration of custom data adapters.
     

  • .NET Data Source - can be any data source reachable by a 'data destination' implementation.
     

  • Flex client application - the box represents an application developed with MXML and compiled with either Flex SDK or Flex Builder. It uses the mx.data.DataService API to connect to a destination managed by WebORB to execute data management operations.

PREPARING THE CLIENT SIDE

The source code for the example is available at:
     client-side: [FDS2 HOME]\jrun4\servers\default\samples\dataservice\contact
     server-side: \Inetpub\wwwroot\weborb\examples\flex\contact\server-side
     database: \Inetpub\wwwroot\weborb\flexdb.mdb

To run the example, make sure Flex Builder, WebORB and Flex Data Services products are installed. The instructions below will guide you through creating a Flex Builder project, pointing it to WebORB, importing the example code and then running the example:

  1. Start Flex Builder. From the main menu select
    File -> New -> Flex Project
     

  2. In the "New Flex Project" dialog window select "Flex Data Services" and "Compile application locally in Flex Builder" as shown in the image below:


    Click "Next >" to continue.
     

  3. Next step is to configure the project to point to a WebORB installation. Assuming WebORB is installed in c:\Inetpub\wwwroot\weborb, the values in the dialog window should look as below:


    Click "Next >" to continue.
     

  4. Type a name for the project and click "Next >" to continue;

     

  5. The next step is to add a client-side library containing the data services API. Select the "Library path" tab as shown in the image below and click "Add SWC...".

    Browse to [FDS HOME]\flex_sdk_2.0\frameworks\libs

    If you are using Flex Data Services 2.0 Beta 3, then elect enterprise.swc.
    If you are using the production release of Flex Data Services 2.0 (including FDS Express), then select fds.swc

    Once you add the swc file, the "New Flex Project" window should look as the image below:

     

  6. Click "Finish". Flex Builder creates default project workspace and opens ContactManager.mxml. By default the application does not have an implementation. To simplify the process, import the code of the finished example.

    To do that copy the following items:

    ContactManager.mxml (this file will overwrite the default application mxml)
    Hourglass.mxml
    mini.mxml
    wait.png
    samples\contact\Contact.as (make sure to preserve the path)

    from \Inetpub\wwwroot\weborb\examples\flex\contact\client-side

    into the folder containing your ContactManager Flex Builder project. You can find out the location by clicking right mouse button on the ContactManager project node and selecting Properties (see the highlighted text in the image below):

The client side of the project is ready to run. There is a minor configuration step for the server-side. See below for details.
 

PREPARING THE SERVER SIDE

The database file used by the example resides in the root of the weborb virtual directory. As a result, in order to make any changes to the database (INSERT, UPDATE, DELETE queries), the ASP.NET subsystem must have the Write permission to modify the file. The instructions below describe how to grant the permission. Without these changes, the database can be accessed as read-only, so only SELECT statement will succeed. Follow the instructions below to modify database file access permissions:

  1. Open Windows Explorer and navigate to the WebORB installation folder (default location is c:/Inetpub/wwwroot/weborb)

  2. Select flexdb.mdb, click right mouse button and select Properties.

  3. Select the "Security" tab and click "Add" to add a user account used by the ASP.NET system

  4. In the "Select Users or Groups" window click "Advanced". New window will open up, click "Find Now". A list of user account will appear at the bottom of the window.

  5. If you are using Windows XP, locate and select the "ASPNET" account. If you are using Windows 2003 Server, locate and select the "IUSR_WEB-B" account. Click OK, to accept the selection, click OK again to close the "Select Users or Groups" window.

  6. Select the user you just added from the list and grant the "Write" permission by selecting the checkbox in the "Allow" column and "Write" row. When you are done, the Security tab should look like in the image below:

     

  7. Click Apply to apply the settings and OK to close the window.

The ASP.NET system now has the permissions to make changes to the database file.
 

RUNNING THE EXAMPLE

To run the application select "Run" -> "Run contactmgr" from the Flex Builder's main menu. Flex Builders open a web browser with the application loaded from http://localhost/weborb/ContactManager/contactmgr.html

 
Copyright © 2003-2006 Midnight Coders, LLC.  Privacy Policy | Contact Webmaster
Home | Products | Customers | Download | Licensing | Forum | Developers | About