Microsoft Learn

XML for Analysis (XMLA)

XML for Analysis (XMLA) is an open, XML-based standard that provides a common interface for client applications to communicate with OLAP (Online Analytical Processing) and data mining technologies. It is a key component for interacting with SQL Server Analysis Services (SSAS) programmatically.

Overview

XMLA defines a set of SOAP-based XML messages that can be used to perform various operations on SSAS, including:

Key Concepts

XMLA Operations

The primary operations supported by XMLA include:

Example: Executing an MDX Query

XMLA Request (Execute)

<?xml version="1.0" encoding="utf-8"?>
<Command>
  <Statement>SELECT {[Measures].[Internet Sales Amount]} ON COLUMNS,
    {[Date].[Calendar Year].MEMBERS} ON ROWS
  FROM [Adventure Works DW2019]</Statement>
</Command>

XMLA Request (Execute with SOAP Envelope)

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <Execute xmlns="urn:schemas-microsoft-com:xml-analysis">
      <Command>
        <Statement>SELECT {[Measures].[Internet Sales Amount]} ON COLUMNS,
          {[Date].[Calendar Year].MEMBERS} ON ROWS
        FROM [Adventure Works DW2019]</Statement>
      </Command>
      <Properties>
        <PropertyList>
          <DataSourceInfo>Provider=MSOLAP;Data Source=localhost;</DataSourceInfo>
          <Catalog>AdventureWorksDW2019</Catalog>
        </PropertyList>
      </Properties>
    </Execute>
  </soap:Body>
</soap:Envelope>

Example: Discovering Data Sources

XMLA Request (Discover)

<?xml version="1.0" encoding="utf-8"?>
<Discover>
  <RequestType>DISCOVER_DATASOURCES</RequestType>
  <Properties>
    <PropertyList>
      <DataSourceInfo>Provider=MSOLAP;</DataSourceInfo>
    </PropertyList>
  </Properties>
</Discover>

Resources