gpt4 book ai didi

c# - ReportingService2010如何使用?

转载 作者:IT王子 更新时间:2023-10-29 04:49:12 26 4
gpt4 key购买 nike

我正在尝试使用报告服务器 Web 服务通过代码部署报告服务器解决方案:http://_Server_Name_/ReportServer/ReportService2010.asmx?wsdl .

遗憾的是我在网上找不到任何示例。只有来自 MSDN 的一些模糊信息.

当通过 Business Intelligence Development Studio 发布时,它会发布共享数据源,然后发布报告。我正在尝试在 C# 上做类似的事情:

var service = new ReportingService2010();
service.Credentials = new NetworkCredential(username, password, domain);

foreach(var dataSourcePath in GetDataSources()) {
string name = Path.GetFileNameWithoutExtension(dataSourcePath);
Byte[] content = GetFileContent(dataSourcePath);
service.CreateCatalogItem("DataSource", name, parent, true, content, null, out warnings);
}

但是 CreateCatalogItem 给我以下 SoapException 异常:

The input XML does not conform to the schema. XML grammar is described in the API documentation. For XML in reports, refer to Report Definition Language syntax. ---> Microsoft.ReportingServices.Diagnostics.Utilities.InvalidXmlException: The input XML does not conform to the schema. XML grammar is described in the API documentation. For XML in reports, refer to Report Definition Language syntax.

我是否做错了什么或我应该采取任何其他方法?

最佳答案

我遇到了同样的问题。我找到的解决方案如下:您使用了错误的数据源文件格式 - 如下所示:

 <?xml version="1.0" encoding="utf-8"?>
<RptDataSource xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" Name="DataSourceXML">
<ConnectionProperties>
<Extension>XML</Extension>
<ConnectString>http://server/_vti_bin/lists.asmx</ConnectString>
<IntegratedSecurity>true</IntegratedSecurity>
</ConnectionProperties>
<DataSourceID></DataSourceID>
</RptDataSource>

正确的是:

<?xml version="1.0" encoding="utf-8"?>
<DataSourceDefinition xmlns="http://schemas.microsoft.com/sqlserver/reporting/2006/03/reportdatasource">
<Extension>XML</Extension>
<ConnectString>http://server/_vti_bin/lists.asmx</ConnectString>
<CredentialRetrieval>Prompt</CredentialRetrieval>
<WindowsCredentials>True</WindowsCredentials>
<Prompt></Prompt>
<Enabled>True</Enabled>
</DataSourceDefinition>

您可以通过从 Reporting Server 下载 DataSource 来获取此定义。

关于c# - ReportingService2010如何使用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5462425/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com