问题描述
我正在尝试使用报告服务器 Web 服务通过代码部署报告服务器解决方案:http:///_Server_Name_/ReportServer/ReportService2010.asmx?wsdl.
I'm trying to deploy a reporting server solution by code using the reporting server web service: http://_Server_Name_/ReportServer/ReportService2010.asmx?wsdl.
遗憾的是,我在网上找不到任何示例.只有来自 MSDN 的一些模糊信息.
Sadly I can't find any examples online. Only some vague information from MSDN.
通过 Business Intelligence Development Studio 发布时,它会发布共享数据源,然后发布报表.我正在尝试在 C# 上做类似的事情:
when publishing through the Business Intelligence Development Studio, it publish the shared data source and then publish the reports. I'm trying to so something similar on 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 异常:
But the CreateCatalogItem gives me the following SoapException exception:
输入的 XML 不符合架构.XML 语法在API 文档.对于 XML 中的报告,请参阅报告定义语言语法.--->Microsoft.ReportingServices.Diagnostics.Utilities.InvalidXmlException:输入的 XML 不符合架构.XML 语法在API 文档.对于 XML 中的报告,请参阅报告定义语言语法.
是我做错了什么还是我应该采取任何其他方法?
Is there something I'm doing wrong or any other approach I should take?
推荐答案
我遇到了同样的问题.我找到的解决方案如下:您使用了错误的数据源文件格式 - 像这样:
I had the same problem. The solution I found is as follows: You are using wrong DataSource file format - like this:
<?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>
您可以通过从您的报告服务器下载数据源来获取此定义.
You can get this definition by downloading DataSource from your Reporting Server.
这篇关于如何使用ReportingService2010?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!