The second post in the XMLA series focuses on the basic structure of XMLA. At its heart, XMLA is XML. As a result it is usually not a comfortable work environment for most database developers or administrators. It is no different for Analysis Services developers or administrators. While a discussion on XML formatting is out of scope for this conversation, I will break down the XML structures used in XMLA so you can see how the basic construction of the language works.
In XML, a namespace is required to help the tools understand how to interpret the content. The namespace used is urn:schemas-microsoft-com:xml-analysis. Usage of the namespace is handled at the method level.
There are two methods supported in the XMLA standard – Discover and Execute.
The Discover method will return XML-formatted results. The Discover statement is similar in function to a SELECT statement in SQL. Discover can be used to query the data within the multidimensional database as well as server information.
Within the Discover method, the following properties are supported which are implemented as child elements: RequestType, Properties, and Restrictions. The RequestType property determines the schema rowset to be returned. The Properties property is a collection of options that can be implemented which are determined by the RequestType. Finally, the Restrictions property can be used to restrict the results returned by the Discover Statement.
Here is an example of getting the list of dimensions from the Adventure Works sample cube (available on CodePlex.com).
The Execute method executes statements against the multidimensional database. The Execute statement can be used to process, deploy and execute MDX statements. It too returns its results in an XML format, including error messages.
The Execute method supports two properties which are implemented as child elements: Command and Properties. The Command property contains the actual command that is being implemented. Properties, like for Discover, enables Command specific properties which can be used to direct the command.
This method is implemented two ways in Management Studio. In the first example, the syntax is explicitly called.
In this example, you can see that Management Studio will wrap execute statements with the Execute and Command elements making it simpler for you to work with Execute methods.
What I do not discuss in this blog is the SOAP implementation. As most of us use Management Studio or similar tools which don’t look at the SOAP envelope, I did not cover it. However, if you need more details on SOAP or on the XMLA standards refer to http://xmla.org for more details.