Login | Register   
RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX

By submitting your information, you agree that devx.com may send you DevX offers via email, phone and text message, as well as email offers about other products and services that DevX believes may be of interest to you. DevX will process your information in accordance with the Quinstreet Privacy Policy.


Web-enable Your Business Intelligence Using XML/A and ASP.NET : Page 5

Exploit the power of XML for Analysis (XML/A) and make your data cubes available via the Web using a simple Web service, an ASP.NET Web Form, and some XSLT to format the data.




Application Security Testing: An Integral Part of DevOps

The OLAPWebservices Project
The sample OLAPWebservices project contains two files of interest: MsXmlAnalysis.cs and FoodMart2000.asmx.. The MsXmlAnalysis.cs class file is the proxy class that the wsdl.exe utility generates from the WSDL file VS7msxmlanalysis.wsdl (see Sidebar 1 for more information). The class provides SOAP wrapper services that make calling the Web service transparent to programmers. The code in the MsXmlAnalysis.cs file contains two methods—Execute and Discover— that perform the functions as defined by the XML/A specification.

The Execute Method

The Execute method executes an MDX query and returns the results as an XmlElement. The method accepts two parameters Command (String) and Properties (XmlElement). The FoodMart2000 Web service also contains an Execute method that accepts two parameters, both of type String. The Execute method from the FoodMart2000 Web service simply calls the Execute method in the MsXmlAnalysis.cs class to obtain the result:

private static string Execute( _ string Command, string Properties) { // Create the Xml for Analysis proxy class MsXmlAnalysis xa = new MsXmlAnalysis(); // This line is to make sure that // we pass the IIS security checks // without any problem. Theoretically, this // should not be necessary, but sometimes, // when you generate a proxy class using // wsdl.exe, it creates a problem, so it's // better to include the following line xa.Credentials = System.Net.CredentialCache.DefaultCredentials; //server url xa.Url = "http://localhost/xmla/msxisapi.dll"; XmlDocument queryDom = new XmlDocument(); XmlDocument restrictDom = new XmlDocument(); XmlElement xelem1; XmlElement xelem2; XmlElement xelem3; // Load the command and propertylist into a DOM // and cast them to an element queryDom.LoadXml(Command); restrictDom.LoadXml(Properties); xelem1 = (XmlElement) queryDom.FirstChild; xelem2 = (XmlElement) restrictDom.FirstChild; // Call the execute method xelem3 = xa.Execute(xelem1, xelem2); // return the resulting XML return xelem3.InnerXml; }

The Discover Method

Although I won't discuss the details in this article, you use the MsXmlAnalysis class's Discover method to explore metadata exposed by OLAP data sources, such as the number of databases available, the cubes in a particular database, etc.

Using the MsXmlAnalysis Web Service
The Web form FoodMart2000.asmx consumes the MsXmlAnalysis Web service. It contains three main methods:

FoodMart2000(): The class constructor sets up the initial property values which it stores in the protected class-level variable Props. It sets properties for the MSOLAP data provider, DataSourceInfo and Format.

Execute(): This private method creates an instance of the MsXmlAnalysis class and calls its Execute method.

ExecuteMDX(): This is the public Web method. It accepts an MDX query string, which it then passes to the private Execute method. When that method returns, ExecuteMDX passes the resulting XML to the client, adding a tag to the returned XML to make it well formed.

Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date