Browse DevX
Sign up for e-mail newsletters from DevX


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

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.




Building the Right Environment to Support AI, Machine Learning and Deep Learning

Creating an ASP.NET Web Services Client
Now that you know the XML/A SDK is working correctly, you can create an ASP.NET application that accesses it.

Creating Web Services:
To create a Web service, you need to know the service description, which is typically encapsulated in a Web service Description Language (WDSL) file. Microsoft provides a WSDL file suitable for creating a proxy class. The proxy class makes the process of sending and receiving SOAP packets to and from Analysis Services transparent.

The sample code contains a C# class named MsXMLAnalysis.cs which was generated automatically from the VS7MsXMLAnalysis.wsdl file. See the sidebar Generating Classes from WSDL Files for the procedure to generate class files from WSDL files automatically.

The sample code that accompanies this article contains two ASP.NET applications. The first application, OLAPWebServices, implements a Web service named "FoodMart2000," which exposes an ExecuteMDX method. The method accepts any valid MDX query within the domain of the FoodMart2000 database. The second application, OLAPWebClient, calls the FoodMart2000 Web service, and displays the returned data on a Web form.

To test the sample:

  1. Open Visual Studio.NET
  2. Create a blank solution called TestOLAP
  3. Add both the OLAPWebClient and OLAPWebservices projects to the TestOLAP solution using the "Add Existing Project" option (see Figure 5).
  4. Rebuild both projects. You should see no compilation errors.
  5. Select the OLAPWebClient, set it as your Startup project, and then press F5 to run the application.
Figure 5: Add the OLAPWebClient and OLAPWebservices to the TestOLAP solution.
On the Web page that appears in your browser, paste the following MDX query into the MDX Query box and then click the Execute button.

SELECT CrossJoin( {[Measures].Members}, CrossJoin( {[Gender].[Gender].Members}, {[Marital Status].[Marital Status].Members} )) on columns,{[Time].Members} on rows FROM Sales

Note: The Web form does not contain any validation code, so if you enter an invalid expression you might see a runtime error message. Figure 6 shows a typical result from running the query.

Figure 6: Here's a typical response from the server when you enter a valid MDX query and click the Execute button.

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