向 ISS/SSAS 发出 XMLA/DAX 请求

Making XMLA/DAX requests to ISS/SSAS

我在SSAS 2019中有一个表格数据库,数据源是SQLServer 2019,需要通过XMLA取数据,所以按照these instructions连接IIS 到 SSAS。

当我使用 POST 方法(HTTP 调用)通过 ISS 向 SSAS 发送 SOAP 请求时,出现以下错误。响应是 SOAP 消息这一事实让我认为问题出在 SSAS,而不是 ISS。

如果我 运行 来自 SSMS(没有 SOAP)的 XMLA 它工作正常,所以它可能是 SOAP 信封的问题。

我试图 google 错误,但找不到任何东西。如何使这项工作?这个解析错误是什么?

<?xml version="1.0"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
 <soap:Body>
    <Execute xmlns="urn:schemas-microsoft-com:xml-analysis">
        <Command>
            <Statement>
                Evaluate DimProduct
            </Statement>
        </Command>
        <Properties>
            <PropertyList>
                <Catalog>TabularProject4</Catalog>
            </PropertyList>
        </Properties>
    </Execute>
 </soap:Body>
</soap:Envelope>

错误响应:

 <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
     <soap:Body>
        <soap:Fault xmlns="http://schemas.xmlsoap.org/soap/envelope/">
             <faultcode>XMLAnalysisError.0xc1270004</faultcode>
             <faultstring>Errors during parsing DIME headers. An unexpected value was 
 encountered in the TYPE field of a chunk record for a DIME message.</faultstring>
             <detail>
                 <Error ErrorCode="3240558596" Description="Errors during parsing DIME 
headers. An unexpected value was encountered in the TYPE field of a chunk record for 
a DIME message." Source="Unknown" HelpFile=""/>
             </detail>
         </soap:Fault>
     </soap:Body>
 </soap:Envelope>

更新

查看SSAS specification中的2.1.1节,DIME表示二进制数据记录,不知道为什么SSAS要尝试读取二进制数据。

例如,如果我没有发送整个 SOAP XML,而是发送 <A>xxx</A>,我会得到同样的错误,因为它仍然尝试解析 DIME 格式。

我找不到解决此问题的方法,所以我最终在 IIS 中托管的 C# 中创建了一个 REST API 服务。 C# 程序访问 Analysis Services 数据库,执行 DAX 语句,并使用数据 returns a JSON。 Java 程序获取调用 API 的数据。此解决方案还有一个额外的好处,因为 XMLA 过于冗长并且 JSON 消息更短。即使有大量数据,这也能正常工作。