0
My C# Webapi looks like this.
using Microsoft.AnalysisServices.AdomdClient;
using System;
using System.Data;
using System.Web.Http;
using System.Xml;
namespace FastReport.WebApi.Controllers
{
[RoutePrefix("FastReport")]
public class ConsultasController : ApiController
{
[Route("ConsultarCubo")]
[HttpPost]
public string ConsultarCubo()
{
AdomdConnection conn = new AdomdConnection("Data Source=localhost;");
conn.Open();
AdomdCommand cmd = new AdomdCommand();
cmd.Connection = conn;
cmd.CommandType = CommandType.Text;
cmd.CommandText = @"<Envelope xmlns='http://schemas.xmlsoap.org/soap/envelope/'>
<Body>
<Discover xmlns='urn:schemas-microsoft-com:xml-analysis'>
<RequestType>MDSCHEMA_DIMENSIONS</RequestType>
<Restrictions>
<RestrictionList>
<CATALOG_NAME>Bahamas</CATALOG_NAME>
<CUBE_NAME>DirectorData Bahamas</CUBE_NAME>
</RestrictionList>
</Restrictions>
<Properties>
<PropertyList>
<Catalog>Bahamas</Catalog>
<LocaleIdentifier>22</LocaleIdentifier>
</PropertyList>
</Properties>
</Discover>
</Body>
</Envelope>";
try
{
System.Xml.XmlReader reader = cmd.ExecuteXmlReader();
var resultadoXml = reader.ReadOuterXml();
reader.Close();
return resultadoXml;
}
catch (Exception ex)
{
return ex.Message;
}
finally
{
conn.Close();
}
}
}
}
When I run the method, I’m getting an error return in Analisys Service that says the following:
The 'Discover' element in row 7, column 72 (namespace urn:schemas-microsoft-com:xml-analysis) cannot appear in Envelope/Body/Execute/Command.
Does anyone know what I might be doing wrong ?
And that namespace is right?
– Leandro Angelo