0

I would like to integrate a DAX query in an xmla and run it on an azure analysis service. The folowing XMLA can be run in management studio successfully:

<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope xmlns:soap = "http://schemas.xmlsoap.org/soap/envelope/">
    <soap:Body>
        <Execute xmlns = "urn:schemas-microsoft-com:xml-analysis">
            <Command>
                <Statement>EVALUATE { BLANK() }</Statement>
            </Command>
            <Properties>
                <PropertyList>
                    <Catalog>MyDatabase</Catalog>
                </PropertyList>
            </Properties>
        </Execute>
    </soap:Body>
</soap:Envelope>

If I integrate this XMLA in C# code like the following:

server.Connect("MyConnectionString;");
Database database = server.Databases.FindByName("MyDatabase");
string query= @"<?xml version=""1.0"" encoding=""UTF-8""?><soap:Envelope xmlns:soap = ""http://schemas.xmlsoap.org/soap/envelope/""><soap:Body><Execute xmlns = ""urn:schemas-microsoft-com:xml-analysis""><Command><Statement>EVALUATE { BLANK() }</Statement></Command><Properties><PropertyList><Catalog>MyDatabase</Catalog></PropertyList></Properties></Execute></soap:Body></soap:Envelope>";    
database.Model.ExecuteXmla(query);

I am getting the following error:

XML parsing failed at line 7, column 53: A text/xml declaration may occur only at the very beginning of input.

Do you have any Idea how can I solve it?

Kaja
  • 2,962
  • 18
  • 63
  • 99
  • im not sure if this helps but did you try to request it without the xml header? We use a soap envelope to but in a different context so im not sure if that might help you out. – Isparia Aug 02 '21 at 09:57
  • I have tried it but I get another error: The soap:Envelope element at line 7, column 87 (namespace http://schemas.xmlsoap.org/soap/envelope/) cannot appear under Envelope/Body/Execute/Command – Kaja Aug 02 '21 at 10:00
  • ok, but this and the error before give you a hint, i think that executexmla opens up a soap envelope for you, based on your connection string. would be nice to have a way to see the complete request before being send to the server/endpoint – Isparia Aug 02 '21 at 10:11

0 Answers0