The NEXT thing to try!!


Random rants and tips about NETCF, WinCE, Emacs, Powershell etc.

Presenting Flex Analysis Services Bridge!!

In my last post, I gave an idea about how one can make their flex application talk to a Microsoft Analysis Services instance. Flex Analysis service Bridge and HTTP pump together provide a layer in between to enable communication between two.

Here is the high level diagram illustrating the design of the bridge and the workflow.Flex Analysis Services Bridge


  1. An XMLA request like DISCOVER_CUBES is sent to the XMLAService.
  2. XMLAService takes the request and uses it to create a SOAP request. The created SOAP request is then sent to the HTTP pump.
  3. HTTP pump (msmdpump.dll) then forwards the request to the Microsoft Analysis Services Instance.


  1. Microsoft Analysis Services respond to the request and send the SOAP reply to the HTTP pump.
  2. HTTP pump then forwards the reply to the bridge.
  3. Bridge then parses the reply and create an actionscript representation of the reply. XMLAService then dispatches an XMLA_RESULT event which can be listened and appropriate action can be taken. After dispatching the event XMLAService also takes care of calling the responders if any registered.

Similarly, when cube.refresh() is called from the Flex application, the bridge starts reading the cube by sending SOAP requests to the HTTP pump which in turn forward these requests to the Microsoft Analysis Services instance. The ASCube keeps parsing the replies and building the cube. It also keeps sending CUBE_PROGRESS events. Once it receives all the replies, it dispatches a CUBE_COMPLETE event.

Same workflow is followed in case of query execution.

I also explained in detail the code you need to write in your flex application in my last post. You can see, after using the bridge it requires almost zero effort to connect with a remote OLAP cube. The implementation is generic enough and is supposed to work in case of a custom XMLA provider like mondrian. The only thing you need there is a serviceURL or in other words an equivalent of HTTP pump which can accepts POST requests. Feel free to use and drop in your feedback.

You can download the code here.

Filed under: actionscript, flex, flex component, OLAP

Talking with Analysis Services from Flex

Since the release of Flex 3 beta 2 with some new features like OLAP APIs and OLAPDataGrid,  requests for integrating the OLAP work with Microsoft Analysis Services have been constant coming in. So the requirement has been to make your flex application access and query a Microsoft Analysis Services instance and display the results in an OLAPDataGrid control.

For fast runners

I have came up with a bridge which lets you access an Analysis Cube <mx:ASCube/>, query it and display the results in an OLAPDataGrid control via an HTTP pump.

I am also providing an <mx:XMLAService/> which allows you discovering your datasources, catalogs and cubes. Well that is simple and my implementation just provides a wrapper to avoid the work involved in  creating each SOAP envelopes and sending them to the server.

In the next part of this post, I am going to explain how this can be achieved in detail.

Creating an HTTP Pump for HTTP access

Analysis Services 2005 uses XML for Analysis 1.1 (XMLA) as its network protocol for communicating with the server. This communication can be configured over HTTP via an HTTP pump. You need to follow these steps to create a pump:

  1. Create a base directory anywhere.
  2. Copy the contents of %Installation folder%\OLAP\bin\isapi into this folder. In my case the location was C:\Program Files\Microsoft SQL Server\MSSQL.2\OLAP\bin\isapi\
  3. Open your IIS Server manager (Run ‘inetmgr’)
  4. Create a new application pool (say OLAP)
  5. Create a new virtual directory (say OLAP) and make it point to the base directory you created in step 1. Also in the access permissions make sure ‘Run Scripts’ is checked.
  6. Choose the application pool created in step 4 for this virtual directory.
  7. You now need to add dll as in application mapping and make it point to the %virtual directory path%/msmdpump.dll
  8. You can configure the security settings based on the security model your Analysis services allows.

A more detail tutorial to configure HTTP access can be found here. After successfully creating the pump, you should see an xml with some error written in it, when run in a browser (http://localhost/OLAP/msmdpump.dll).


XMLAService is wrapper written in Actionscript to retrieve information about the Analysis services instance configured above. It accepts three type of requests (xmlaRequest):

  1. DISCOVER_DATASOURCES – discover all the available datasources.
  2. DISCOVER_CATALOGS – for a given datasource, discover all the available catalogs.
  3. DISCOVER_CUBES – for a given catalog, find all the available cubes.

XMLAService internally converts these requests into SOAP requests and also returns the result as an Array of the resource names requested. A request object could be one of these:

<mx:Object id="catalogsRequest" type="{XMLAService.DISCOVER_CATALOGS}">
<mx:Object id="cubesRequest" type="{XMLAService.DISCOVER_CUBES}">
<mx:Object id="discoverRequest" type="{XMLAService.DISCOVER_CUBE}">

The declaration of XMLAService looks like:

<local:XMLAService id="hs" url="http://localhost/olap/msmdpump.dll" 

where xmlaResult is the event it dispatches after successfully retrieving and parsing the results. For sending a request say to discover all the available datasources one needs to write:

private function getDataSources():void
    hs.xmlaRequest = dataSourcesRequest;
private function xmlaServiceResultHandler(event:XMLAEvent):void
    if(event.requestType == XMLAService.DISCOVER_DATASOURCES)
        dataSources = event.xmlaResult as Array;

Once we have discovered the resources available and decided upon the cube we wish to connect to we can proceed with accessing our Analysis Services Cube.

Analysis Services Cube

An ASCube can be declared like this:

<ASCube:ASCube id="cube" 
catalog="Analysis Services Tutorial" 
name="Adventure Works DW"

After declaring the cube, one can trigger the cube discover process by calling cube.refresh(). Discovering a cube works by sending SOAP requests to discover all the cube elements (dimensions, hierarchies, attributes and levels) in a breadth first manner. Thus one needs to write the following code to trigger this.

private function initCube():void
    cube.addEventListener("complete", completeHandler);
    cube.addEventListener("progress", showProgress);

Querying the cube and displaying the results.

Once the complete event is dispatched, the AScube is ready to be queried. One can query the cube created above as follows:

private function executeQuery():void
    var token:AsyncToken = cube.execute(new ASQuery(query));
    token.addResponder(new AsyncResponder(resultHandler, faultHandler));
private function resultHandler(result:Object, token:Object = null):void
    odg.dataProvider = result as IOLAPResult;
private function faultHandler(info:Object, token:Object = null):void
    if(info && info.message)

Once the results are retrieved, they can be displayed using the OLAPDataGrid control by setting the dataProvider property. The ASCube implementation also takes care of the query errors. The error string returned by the Analysis Server can be obtained in the faultHandler from info.message. The info object also contains the error code ( of the error which could be useful in some situations.

I tried this workflow on AdventureWorks sample (a free sample provided by Microsoft) and it takes some 7s to read the cube structure. The implementation is in alpha phase and requires improvements based on the feedback I get. I will be posting the code tomorrow (well, it is almost ready!!). As of now I am putting some snapshots of my sample application.

  1. Querying the AdventureWorks cube and displaying the result in OLAPDataGrid. – link
  2. Querying with an erroneous query and showing the error-link

Filed under: flex, OLAP

My AIR apps wishlist

I have been constantly keeping myself updated with all the apollo apps coming up. Since the alpha release of apollo lot of Desktop applications have been built on top of apollo. Here is a list of few of the applications built using AIR. I particularly liked Fresh, DiggTop, SearchCoders, AirTalkr and AirPress, reason being that they fall into the category of things I do most of the time (I am not a flickr and youtube fan, and I hardly visit these sites). I believe apollo has got capabilities to provide a good compettion to those old .NET based windows apps, and replace the traditional desktop experience.

With the apollo getting matured, I have came up with a wishlist of apps/features, I would love to see in the future. Here it goes:

  1. A mail notification app which can handle atleast IMAP.
  2. A yakuake kind of terminal window, in general a way to wrap windows application in apollo so that I can customize it’s layout based on my needs.
  3. An Object Dock kind of fish eye component, which acts as a quick launch bar in windows. Similarly, If I want a Alt-F2 kind of utility(which is there in linux to run any application) or may be in windows there is a Launchy utility. As of now this is not possible, because AIR doesnt allow executing an external application.
  4. An expose like effect it an application. Something which can allow pushing some basic effects and layouting of currently active WINDOWS apps.

Beside this I really wish if we can get rid of Adobe’s right click philosphy and have good support of customizing the context menu, atleast for AIR, it makes sense to do this (Because AIR is not just flash!!!). I strongly thing with out context based context menu any application will lag that experience which most of the world is used to (Linux and Windows users). Say AIRPress, while writing a blog w/o the right click it becomes little uneasy to do things like spelling correction, and some basic formatting stuff similar to what we get in Windows Live Writer (and that is why I prefer it). Well Live Writer also has got other features like playing with the inserted images. It also allows inserting maps

Adobe has now release beta2. Here one can read the list of features added in this release.

Filed under: flex

Exploring an IOLAPCube

Leveraging the capabilities of AdvancedDataGrid, I have implemented the IHierarchicalCollectionView and created a cube browser component.

CubeBrowser provides a tree kind of view for exploring the cube elements viz dimensions, hierarchies, attributes, levels and members.

CubeBrowser exposes cube propery to build an IHierarchicalCollectionView to build the required view.

<local:CubeBrowser cube=”{myOLAPCube}”/>

Click here to see a demo application.

It also uses the drag-drop feature in AdvancedDataGrid provides, and by enabling dragEnabled propery one can drag and drop a particular item in a list. I have overridden the default drag and drop behaviour and so that the dragged items are added under “items” rather than “treeItems”. This is particularly useful in case one wants to build a query editor kind of thing.

Click here to get the source for the component.

Filed under: flex, OLAP

Adobe flex offers an in-memory OLAP Cube

With the announcement of beta 2 release of flex 3, Adobe provides support for multidimensional analysis of data. The new OLAP APIs and OLAPDataGrid, Flex 3 is offering it is now possible to do multidimensional analysis of your data and display it in a cross tab fashion in OLAPDataGrid.

The idea here is to have an in-memory representation of an OLAP Cube which can be queried using OLAP query APIs. The query APIs look similar to the well know MDX query language but query support is through APIs rather than a query language like MDX. The query result can also be shown using an OLAPDataGrid control. OLAPDataGrid control itself is highly customizable and one can use custom styles, formatters and renderers to suite your needs.

What about remote olap servers like Microsoft Analysis services, mondrian? Ahh, good question!!!the OLAP API’s are very generic and one can get the functionality by implementing the interfaces provided. If that sound like too much to do, believe me its not. I will be posting a sample very soon for interfacing with Microsoft Analysis services.

If you are finding this interesting and want to find out how to achive this, read the write up here. There is also a captivate video which demonstrates how to create your first cube.

So my suggestion is do give it a try!!

Flex 3 beta 2 can be download from the following link

Filed under: flex, OLAP

Adobe Flex 3 beta 2 is out, Linux FB? WOW!!

Well the old news first, Adobe has released Flex 3 beta 2 with whole lot of improvements and few new features. With this release, flex community has got oppurtinity to explore the capabilities Adobe flex 3 will be offering in their final release. Read the release notes here.

October 2 was a big day for Adobe Flex, when Ram showcased about FlexBuilder Linux at MAX 2007. Read swaroop’s post (the developer behind the success). An excerpt from his post:

Now presenting the alpha of the Flex Builder IDE on Linux! (this was announced at the Adobe MAX 2007 conference). You can now create Flex projects, write code with intellisense-like hinting, compile and debug all within an IDE based on Eclipse, on Linux. You heard it right, it’s officially supported by Adobe

Read the corresponding slashdot article and discussion by mikepotter.

This will surely help to create a buzz in the linux developers community. After reading the discussion which is going I realized many people haven’t even heard about flex and somebody interpreted it as “Flex builder is a fast lexical scanner generator builder”. Now when they have an option to build RIA applications in linux also (using an IDE), many people will surely give flex a try. Adobe is offering it FREE and so the price concern is also not there.

I am just waiting for the time when Adobe will give an AIR (apollo) for linux and the linux flex builder will start supporting development of apollo applications. They have promised it on labs. I personally consider Apollo as a huge step by Adobe and having it on linux will make developing desktop applications very easier. Once this thing is achived I am sure Adobe Flex will get to see a large growth in the flex community.

Filed under: flex, linux

AIRPress, blogging on wordpress

Airpress, a nice kool little AIR app for blogging in wordpress. With the offline edition mode, it fits very well with the requirements of a blogging Desktop application like Windows Live Writer.
With all the super kool effects and UI, it just looks great. Drag and drop support for inserting images and other content is also helpful. I am myself writing this post from AirPress itself.

In my first attempt with the tiny app I found few issues:

  1. It doesn’t allows something like editing html so the corruption made by the UI can’t be corrected.
  2. Drag and drop operation on an image can be undone.
  3. You can’t place the text around an image in smarter ways.
  4. And last but not the least don’t even attempt drag and drop of a swf, it starts playing the swf in the player. May be a FOL only. But I think drag drop of only limited filetypes should be allowed. Anyways, wordpress will not accept the other filetypes.
  5. Undo functionality doesn’t work properly.
  6. And ya, I found an RTE also while dragging an HTML file
ArgumentError: The width of an HTMLControl can not be greater than flash.html::HTMLControl/flash.html:HTMLControl::validateAndConvertDimension()[C:\Documents and Settings\acrorel\Local Settings\Temp\aslibc-28157\]at flash.html::HTMLControl/set width()[C:\Documents and Settings\acrorel\Local Settings\Temp\aslibc-28157\]at
at MethodInfo-3991()
at[C:\Documents and Settings\acrorel\Local Settings\Temp\aslib-28157\]
at flash.html::HTMLControl/flash.html:HTMLControl::onCompleteTimer()[C:\Documents and Settings\acrorel\Local Settings\Temp\aslibc-28157\]
at flash.utils::Timer/flash.utils:Timer::_timerDispatch()
at flash.utils::Timer/flash.utils:Timer::tick()[C:\Documents and Settings\acrorel\Local Settings\Temp\aslibc-28157\]

Filed under: Blogging, flex

Flex compiler options

Inspired by the post on JVM Settings, I have came up at the list of mxmlc/compc options available.

Here is the link. For scripting folks[:)], such a list can be easily generated by running the following script.

After writing this I was wondering if it is possible to know with what options a swf/swc was compiled. I am not sure about other use cases but one use case could be while working with swfs of different versions. If I want to load a swf using SWFLoader I need to know its version (it is possible using swfdump, but that is too much of work to do I think).

Filed under: flex

Using Flex™ 2.0.1 Language Reference offline

After playing with HTML Help Workshop for some time I have managed to compile the Flex™ 2.0.1 Language Reference in CHM format (CHM files are extensively used for documentation and help files).

This is similar to Help Window we get with the Flex Builder. FlexBuilder has a limitation that it doesnt allow using help unless FlexBuilder is open. This is where such a CHM is useful. It also has got search functionality and thus serves the purpose. Here are the steps to create a CHM file:

  1. Download Flex Language Reference from livedocs or alternatively take the zip from {Flex Builder installed location}/plugins/ (thanks to Sreenivas for pointing out this) and unzip it.
  2. Say the docs are located on PATH/flexapi.
  3. Download HTML Help Workshop from the following link and install it.
  4. Open HTML Help Workshop and go to File -> New and select Project. It will start a wizard.
  5. Give a name (say flex2.0.1_asdoc ), when asked for name of the project file.
  6. After clicking next, select HTML files checkbox (because we already have our doc created)
  7. In the next dialog box, press Add and give path of the index.html (PATH/flexapi/index.html)
  8. Click Finish to finish the wizard

Press Save to save the project and compile the project and click View Compile file button on the toolbar. You will find that the file created is broken because it has not included all the files. So we need to fix this. Actually HTML Help workshop has a limitation that it doesn’t pick files specified in CSS stylesheets and javascripts. Follow these steps to fix this:

  1. Close the project. And go to the project folder and open the .hhp file in any editor. You will find a [FILES] section in the file with index.html listed.
  2. Just do a find to find all the class-list.html files in the PATH/flexapi/ folder and add all those class-list files (with full path) after index.html
  3. Save this template.html file in the PATH/flexapi/ folder.
  4. Add template.html also to the list of [FILES] in .hhp file.

Now open the project again and re-compile the project. Use the CHM created when you are offline and not using FlexBuilder.

Here is a screenshot of CHM file I got. You can also take advantage of the search functionality and here is a screenshot for this.

Filed under: actionscript, flex

A must-see blog post

James Ward has published a really awesome benchmark application which compares different ways of loading data into Rich Client Applications(AJAX and Flex).

One can tryout the benchmarks at

In the next release, he would be including Laszlo also in the game. Along with that he also intends to build richer benchmark applications including Datagrids in AJAX also. Let’s wait for the next release of this beautiful work to come up.

Filed under: flex

About the author

25, Male, living in Hyderabad Mobile Developer, working for Microsoft IDC

View Nisheet Jain's profile on LinkedIn

RSS Mobile Dev Blog

  • An error has occurred; the feed is probably down. Try again later.