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.![]()
Request:
- An XMLA request like DISCOVER_CUBES is sent to the XMLAService.
- XMLAService takes the request and uses it to create a SOAP request. The created SOAP request is then sent to the HTTP pump.
- HTTP pump (msmdpump.dll) then forwards the request to the Microsoft Analysis Services Instance.
Reply:
- Microsoft Analysis Services respond to the request and send the SOAP reply to the HTTP pump.
- HTTP pump then forwards the reply to the bridge.
- 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
woow!!! nice work.
I download it and test and work fine.
I have a problem with OLAPDatagrid, it puts the CPU at 100% when I use horizontal scroll. u not?
Excelent Lib. Thank You
This is great, you might want to add a license so people can use it. Very cool. Thanks.
This is great stuff, thanks. But fyi the code download wouldn’t build for me until I removed the get keyword from the isAll and isMember method declarations in ASmember.as
Hmmm.. I couldn’t get it to work, it tells me the following:
“Could not resolve to a component implementation.”
Any ideas?
I tried running the XMLAServiceSample. When clicking the Discover Datasource, my computer/server name instantly comes up. However, clicking Discover Catalogs doesn’t work. My browser status bar just shows transferring data from local host and I am still left with a blank drop down list box for catalogs.
I figured out the problem I have been experiencing. Basically I didn’t have roles associated with my Analysis Server Database. I simply had to add an admin rols with the username “IUSR_”.
I have tried this against Mondrian OLAP Engine and works fine.
Is the source code avaialble any of the Open Source licenses?
I have having trouble configuring the sample files in FB3 – any clues there..? Many thanks.
I was trying to get this example working with Mondrian, but I had to fix several bugs and I’m not battling with another null reference.
Has anyone had any luck with this?
Just to reiterate Yam’s point above, it is important that you have the security of IIS configured properly or you will not be able to retrieve anything other than the datasources list.
There are a couple slight bugs in the bridge that I fixed in my local copy:
– When an xml response is sent back from the server but does not contain any items, the result handler is never called, nor is a fault. This makes it difficult (impossible?) to do any error checking.
– If you don’t fill the DATASOURCE_NAME and CATALOG_NAME properties in the cubes request call, the code will fail silently and never make a server call, again – no error is raised.
In case it proves useful to anyone, this is how I am handling my initialization:
public function creationComplete():void
{
hs.xmlaRequest = datasourcesRequest;
hs.send();
}
public function xmlaServiceResultHandler(event:XMLAEvent):void
{
if(event.requestType == XMLAService.DISCOVER_DATASOURCES)
{
arDataSources = event.xmlaResult as Array;
Status &= DATASOURCES;
catalogsRequest.DATASOURCE_NAME=arDataSources[0];
hs.xmlaRequest=catalogsRequest;
hs.send();
}
if(event.requestType == XMLAService.DISCOVER_CATALOGS)
{
arCatalogs = event.xmlaResult as Array;
Status &= CATALOGS;
cubesRequest.DATASOURCE_NAME=arDataSources[0];
if(arCatalogs)
{
if(arCatalogs.length > 0) cubesRequest.CATALOG_NAME=arCatalogs[0];
else cubesRequest.CATALOG_NAME=”;
}
else cubesRequest.CATALOG_NAME=”;
hs.xmlaRequest=cubesRequest;
hs.send();
}
if(event.requestType == XMLAService.DISCOVER_CUBES)
{
arCubes = event.xmlaResult as Array;
Status &= CUBES;
}
}
Fixed a bug in ASMDDatasetResult.as – the formattedValue wasn’t returning.
Just replace the original function with this to fix:
/**
* The formatted value in the cell.
*/
public function get formattedValue():String
{
return xml.*[1];
}
I figured out a way to get OLAPDataGrid to use the formattedValue sent from the server instead of the raw value. It took me several hours of tracing to figure out, so I thought I’d share it here and hopefully save someone the time.
The comment filter hid the code I tried to post, here it is again in script form. To get this to work, add an inline itemRenderer to the OLAPDataGrid, inside the Component tag add a mx:Label tag, inside that add a script block with this code:
import mx.olap.IOLAPCell;
import mx.olap.IOLAPResult;
import mx.controls.advancedDataGridClasses.AdvancedDataGridListData;
import mx.controls.listClasses.ListData;
import mx.controls.OLAPDataGrid;
override public function set data(value:Object):void
{
super.data=value;
var ld:AdvancedDataGridListData = listData as AdvancedDataGridListData;
var c:IOLAPCell;
c=((ld.owner as OLAPDataGrid).dataProvider as IOLAPResult).getCell(ld.rowIndex,ld.columnIndex-1);
if(c) this.text=c.formattedValue;
else this.text=”;
}
If you have trouble getting it working email me at claytongulick [at] yahoo (dot ) com
Млин, спамеры просто достали уже этим своим примитивом!
Как хорошо что удалось отыскать такой замечательный блог, и тем более отлично, что есть такие автора толковые!
Что то слишком мудрено… И по-моему расчитано на блогера чем на вебмастера
how do i setup up this library to get data from Mondrian?
Can somebody help on this?
[...] Kommunikation zwischen der Flex-Anwendung und dem Olap-Server kann momentan über XMLA erfolgen. Hierbei handelt es sich leider um einen veralterten Standard. So muss man gespannt [...]
Hello Guys
I have a problems to probe this code, dont have a manual or related information? of course i’m novice in flex.
Hi Guys,
I got several issues to discover some cubes on my SSAS catalog.
After several hours I found that the ‘catalog’ property was missing when creating the request for cubes.
This is the function getCubes with the ‘catalog’ property added.
Hope it helps
public static function getCubes(dataSourceInfo:String, catalog:String):XML
{
var properties:XML = makeProperties([""+dataSourceInfo+"",
""+catalog+"",
"Tabular "]);
var restrictions:XML = makeRestrictions([""+catalog+""]);
var SOAPEnvelope:XML = addSOAPHeader(getDiscoverRequest(XML(MDSCHEMA_CUBES),
restrictions,
properties));
return SOAPEnvelope;
}
Hello All,
I was wondering if the above solution will work with Flex 3?
Hi Guys,
Thank you very much to share this great,but I do not download the code,Can you put the code to my email?
Thanks.
Каждого мужчину где-то ждёт женщина, но неизвестно где, поэтому не каждому удается избежать этой встречи.
Труд и только труд сделал человека. Угрюмым и горбатым.
Hi, i have problem with Mondrian Engine, please a need help, the error the side server mondrian, is
java.lang.IllegalArgumentException: Accept header ‘*/*’ is not a supported respo
nse content type. Allowed values: text/xml, application/xml, application/json.
at mondrian.xmla.XmlaServlet.doPost(XmlaServlet.java:248)
Please i need Help
Hello,
Thanks for the nice work. I am having issues to compile this. Could someone post an updated instructions on how to go about building this, please? It would be tremendous help.
We are using Adobe Flash Builder 4.
Thanks in advance
Venkat