First steps in developing sexy screens for Bpel Processes … yep that’s right … let’s do some Flex-and-Oracle-SOA Integration

Today I started building my first Flex application using Data Management Services … why Data Management Services I hear you thinking.

Don’t get me started on that topic ;o)

The Flex Data Management Service (FDMS) provides a mechanism to maintain data distributed over the client and server tiers.

The Service supports features such as:

  • Data Synchronization
  • Data Replication
  • Occasionally Connected Clients

Additionally, this mechanism offers the possibility of extended functionality in a couple of areas:

  • Automatic synchronization of multiple clients viewing the same accounts data via server “push”.
  • Automatic re-synchronization of client and server data following a server or communications outage.

Now you know why I would choose for FDMS, indeed less work for me and less code to maintain.

The FDMS will need to communicate with my Oracle BPEL Processes which hold all the nesessary process-flow and business logic. How can I interface Flex and BPEL … well no ifficulty lies in there because every deployed BPEL Process is a Web Service so let’s start interfacing.

This also means I’m working with two IDE’s , one for the front-end and one for the back-end:

  • Back-end: JDeveloper to design the bpel processes and define proxies for these processes
  • Front-end: Eclipse to integrate flex and bpel processes, to define FDMS, ActionScript, mxml-files, …

So I’ve packaged my webservice proxy’s and added them on the classpath of my flex-application. Now I need to define my Assembler-class to be able to hook up the bpel processes with FDMS.

In order to integrate the prototypes client tier with the back-end server tier using Flex’s Data
Management Service mechanism, I need to implement a custom Java “Assembler” class.

The Flex Data Service instantiates the Assembler java class and invokes its methods.

To enable this, two additional things need to be done on the server side:

  • The Web Service Proxy to be called needs to be included in the Flex Data Services classpath.
  • The Flex Data Services configuration files need to be updated with a definition of the
    Data Management Service.

For the client tier I need to define the needed ActionScript objects that will be mapped automatically to the POJO’s used in my Bpel Process (Web Service).

The only downside of this, is the need for defining this one-to-one mapping in an ActionScript object whilst in these days you would use IntroSpection to accomplish this. Now I need to duplicate the object-declaration which is already known in POJO’s as well in ActionScript-objects.

Untill now I’m defining all the needed ActionScript-objects manually, aren’t there any generators available for this monkey-task, and afterwards I can start building the UI using mxml.

Buzzing About Adobe Flex – Part 2

Some useful background information you need to know about Adobe Flex … (which you can find in the Adobe Flex Developer Guide):


About Flash Player 9
While Flex applications run in a browser, they take advantage of the Flash Player 9 runtime environment for executing client-side logic, rendering graphics, and playing animation, audio, or video.
Flash Player 9 supports a new higher-performance version of ActionScript
(ActionScript 3.0) that works in conjunction with the expressiveness innovations
in Flash Player 8.

At the core of the Flex product line is the Flex Software Development Kit (SDK). Flex 2 SDK consists of the Flex framework (class library), the Flex compilers, the debugger, the MXML and ActionScript programming languages, and other utilities. Flex SDK also includes the source code for the core Flex framework class library, enabling you to study the code of the classes as well as customize or extend them for your own use.

About Flex Builder 2
Flex Builder is an integrated development environment (IDE) for developing applications with Flex SDK, Flex Data Services, and the Flash Player. The Flex Builder IDE provides tools that help you develop, design, and debug Flex applications, including an integrated incremental compiler and a step-through debugger.

About Flex Data Services 2
You build on the functionality of Flex 2 SDK by adding Flex Data Services. Flex Data Services adds enterprise messaging support and a greatly enhanced data services architecture to the Flex 2 SDK. You deploy Flex Data Services as a standard web application on your J2EE application server or servlet container.

- Adobe Flex Developer Guide - is the document to have a look at.

Today I want to have a closer look at the data-binding layer of Adobe and how I can create CRUD-screens.


Working with data services
Flex is designed to interact with several types of services that provide access to local and remote server-side logic. For example, a Flex application can use AMF to connect to a web service that uses the Simple Object Access Protocol (SOAP), an HTTP URL that returns XML, or for Flex Data Services, a Java object that resides on the same application server as Flex. The MXML components that provide data access are called data service components. MXML includes the following types of data service components:
WebService Provides access to SOAP-based web services.
HTTPService Provides access to HTTP URLs that return data.
RemoteObject Provides access to Java objects (Java Beans, EJBs, POJOs) by using the AMF protocol. This option is only available with Flex Data Services or Macromedia ColdFusion MX 7.0.2.

I need to use the Flex Data Services to be able to add data-bound components into my Adobe Flex Application.

How to build a Data-Driven application (using the Adobe Flex Developer Guide, Chapter 9):

Using the HTTPService – data service component I’m able to integrate an existing rss-feed from a blog to populate a DataGrid-component in my Flex Application. Looks very fancy and it’s not hard to try this out.

Using the WebService – data service component I can call a webservice and get back the results in a datagrid-component. You can learn how to pass parameters into the webservice and how to react when the webservice is calles, e.g. when the user invokes a certain action or when the application has been displayed (e.g. onPageLoad or to say in Flex-language on
creationComplete). You will actually work in the same way as when using the HTTPService only you’re invoking a webservice endpoint instead of a HTTP request.

Data Management Services, chapter 19, discusses the different adapters that are need to use persistent or transient data in an Adobe Flex Application.
The ActionScript object Data Management Service adapter persists data in server memory and is useful for applications that require transient distributed data that is not persisted.
The Data Management Service Java adapter will be used for data that is persisted to a data store.

I need to download a trial version of LiveCycle Data Services ES , to be able to integrate Data into my Adobe Flex application.

I’ve already tried to create a Database Accessor to my Oracle schema but this doesn’t seem to work regarding a bug reported by Adobe. When you try to create a connection to an oracle db with more than 1 schema, which would be the case for 99% of th time, the data connector can’t establish the connection.

So when you want to create a CRUD-application using Oracle as your db, you need to wait for a patch/new beta release.

What are the pro’s and con’s I’ve seen today:

  • Pro: integrating a HTTPService, a blog for example, is very straightforward and doesn’t ask any specific modifications or knowledge from the developer (except reading the dev guide ;o) )
  • Con: renaming the mxml file still holds the old swf- and html-files in the bin-folder, these can be removed manually without any impact on the application
  • Con: Not able to delete a Database Accessor you’ve defined earlier, not clear how to edit the existing Database Accessor either
  • Con: Exceptions thrown when having a look at existing , e.g. try to access www.papervision.org twice in a new browser session => the following error is shown:

ArgumentError: Error #2082: Connect failed because the object is already
connected. at flash.net::LocalConnection/connect() at
com.noventaynueve.underwater::Launch() at main() at
[execute-queued] at [io]

That’s it for today … I hope I can build a small application using an Oracle database.

Buzzing about Adobe Flex

I’ve heard a lot of rumours and buzzing around Adobe Flex … so what’s the catch ;o)

For one of my projects I need to get acquanted with Adobe Flex to see what it has to offer and how fast you can learn and implement a real-time application (small test case). I’ve already created a small test case in ADF and now I need to have a look at Adobe Flex .

With my Oracle Fusion Middleware background, ADF for example, I can make a comparison with Flex, how intuitive is the IDE (it’s based on Eclipse), what about J2EE-requirements such as bindings between the different tiers, …

One major drawback of Flex is that it’s again another proprietary code you have to learn, using basic xml tagging but yet another format, another language. If I have a look at ADF it’s much more standardized and if you have a J2EE background it’s comprehensive and you just use the existing knowledge and experience to build on.

But that’s enough talking wright … let’s create a Flex playground =>

First I’ve installed a trial version of flex builder 3 and then I went to search the internet for some sort of a ‘Adobe Flex for dummies’-guide ;o)

I’m using the quickstart guide, which you can find on http://www.adobe.com/devnet/flex/quickstart/coding_with_mxml_and_actionscript/ to get started with Adobe Flex.

The first impressions are … sexy and vivid applications with the same look & feel as flashplayer applications. Let’s try and create one myself:

  1. The first section in the Quickstart-guide : Coding with MXML and ActionScript works very well, and if you want to use the TIP

Tip: To see the intermediary ActionScript files that Flex generates, add the
–keep-generated-actionscript option to your mxmlc command.

Just use this command in the developer-prompt of adobe flex:

C:\adobe_flex\QuickStart>mxmlc –strict=true –keep-generated-actionscript MyFirstExample.mxml

After you’ve done the first chapter you were able to define and compile a flex application using the Adobe Flex 3 SDK Command Prompt.

In the second chapter : Creating your first application , you perform almost the same exercise but now you’ll use the Flex Development Environment which uses the Eclipse IDE. So J2EE Developers which are used to Eclipse should recognize this immediatly, it’s the same IDE you’re working with, only the needed plug-ins for Flex are added/used.

Steps you need to perform to build a ‘hello world’ (sounds familiair) application:

  1. Create a new Flex Project (accept all the defaults)
  2. Copy/paste the code from chapter 2 and choose to run the application
  3. Start playing around yourself

Let’s compare the IDE I’m used to, which is JDeveloper, with Adobe Flex Builder 3 using the sample application from the 2nd chapter.

  1. :( => I can’t re-organise my components in the outline-view which can be compared to the structure-view in JDeveloper. I have to use the design-or source-view in Flex to re-organize the components, let’s say for instance I want to move my components (textarea, panel and label) from the tile into a VDividedBox, I need to do this in the source-or design-view and can’t rearrange using the outline-view.
  2. :( => I don’t have a look-up of the existing functions that are defined in the mx:
    Script tag. To avoid erroneous referring of functions in the CDATA-part you could have a drop-down or look-up of the existing functions in the properties that can use these, e.g. the onclick-event could have such a drop-down. This is usefull code insight when working with the ‘Flex Properties’-panel in the IDE.
  3. :) => The code-insight on each component (each component you’ve defined an ID for, such as myText or myLabel) is very helpfull to have a look at the available methods on these objects.
  4. :) => different ways of specifying eventHandlers which gives each developer the choice between different approaches and if you’re referring to a non-existant label/field/method a compile time error will be shown.
  5. :) => when you’ve messed up the mxml file, meaning the tags aren’t constructed properly anymore for a mx:application, the design-tab won’t work anymore. This is a very handy feature because it will point you to the code that produces the exception. You have the possibility to check what’s wrong with your source code without having to search inside your mx:application for tags that aren’t closed properly etc. In the following screen-shot you can see the behaviour:

That’s it for playground time today, I have to get back to business with JDeveloper but untill now I’m still curious.