如何使用ReportingService2010?
我正在尝试使用报告服务器 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 异常:
输入的 XML 不符合 架构。 XML 语法描述于 API 文档。对于 XML 中 报告,参见报告定义 语言语法。 ---> Microsoft.ReportingServices.Diagnostics.Utilities.InvalidXmlException: 输入的 XML 不符合 架构。 XML 语法描述于 API 文档。对于 XML 中 报告,参见报告定义 语言语法。
我做错了什么或者我应该采取其他方法吗?
I'm trying to deploy a reporting server solution by code using the reporting server web service: http://_Server_Name_/ReportServer/ReportService2010.asmx?wsdl.
Sadly I can't find any examples online. Only some vague information from MSDN.
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);
}
But the CreateCatalogItem gives me the following SoapException exception:
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.
Is there something I'm doing wrong or any other approach I should take?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
我也有同样的问题。我找到的解决方案如下:
您使用了错误的数据源文件格式 - 像这样:
正确的格式是:
您可以通过从报告服务器下载数据源来获取此定义。
I had the same problem. The solution I found is as follows:
You are using wrong DataSource file format - like this:
The right one is:
You can get this definition by downloading DataSource from your Reporting Server.
下面是从报表服务器中获取每个项目的 XML 的方法,从某种意义上说,这是一种从报表服务器“下载”包括“数据源”在内的任何对象的 XML 定义的方法(假设您的报表服务器数据库是 ReportServer):
对于 SQL 数据源,这是我们的定义:
需要记住的一件事是,我们无法找到一种方法来更改 .rds 文件并使其与报告 IDE 和自动部署一起使用。我们将 .rptproj 与 Visual Studio 2008 一起使用(Visual Studio 2010 无法与 Sql Server 2008 R2 Reporting Server 项目一起使用)。 Visual Studio 2008 要求数据源文件(*.rds 文件)采用旧架构格式,这不适用于 rs.exe 和 CreateCatalogItem。
如果我们将 .rds 文件转换为适用于 CreateCatalogItem 的格式,则 Sql Server 2008 R2 Reporting Server 项目在尝试打开 .rptproj 时会出现以下错误:
Here's a way to get the XML for each item out of the report server, in a sense a way to "download" the XML definition for any object including a "DataSource" from the Reporting Server (assuming your report server database is ReportServer):
For an SQL data source this is the definition we had:
One thing to keep in mind is that we could not find a way to change the .rds files and get it to work with both the reporting IDE and automatic deployment. We are using a .rptproj with Visual Studio 2008 (Visual Studio 2010 can't work with Sql Server 2008 R2 Reporting Server projects). Visual Studio 2008 requires the DataSource files (*.rds files) to be in the old schema format, which won't work with rs.exe and CreateCatalogItem.
If we convert the .rds file to a format that works with CreateCatalogItem, the Sql Server 2008 R2 Reporting Server project gives the following error when trying to open the .rptproj:
我从未真正尝试过通过目录添加数据源,但我确实知道一种肯定有效的方法。
您所需要做的就是创建一个与您要发布的报表中引用的数据源同名的数据源。
以下是来自 MSDN 的使用 ReportingService2010 的示例:
下面是发布报告并创建数据源的代码,虽然不是为 Reportingservice2010 编写的,但将其移至 2010 应该不难:
I've never actually tried adding a DataSource through the Catalog, but I do know a way that works for sure.
All you need to do is create a datasource that is the same name as the datasource referenced in the report you are publishing.
Here is an example from MSDN using ReportingService2010:
Here is the code to publish a report and create a datasource, although not written for Reportingservice2010, it shouldn't be to hard to move it over to 2010:
我刚刚发现 CreateCatalogItem 的 msdn 文档 是误导。
我尝试使用 Web 服务以本机模式(不是 Sharepoint)部署新报告,当我按照 Parent 参数的指导进行操作时出现错误:
页面上的代码示例显示了这一点:
所以我尝试使用这种格式:
我收到以下错误:
然后我在注释中注意到这一点(与末尾有斜杠的示例相矛盾):
经过反复试验,我最终能够通过将父路径设置为文件夹路径并在开头加上正斜杠来部署报告:
I have just discovered that the msdn documentation for CreateCatalogItem is misleading.
I was trying to deploy a new report in native mode (not Sharepoint) using the webservice, and got an error when I followed the guidance for the Parent parameter:
The code example on the page shows this:
So I tried using this format:
I got the following error:
Then I noticed this in the remarks (contradicting the example which has a slash at the end):
After trial and error I was eventually able to deploy the report by setting the parent path to just the folder path, with a forward slash at the start:
只是想提供一些指导。大约一年前,我使用 ReportingService 服务遇到了一些问题,并且在网上发现了很少的信息,所以我从中学到的东西我发布在这里 - 希望这会有所帮助。
http://www.ericwitkowski.com/2013/05 /an-introduction-to-querying-and.html
Just wanted to offer some guidance. I ran through some issues a year ago or so with the ReportingService services and also found little information online, so what I learned from it I posted out here - Hope this helps.
http://www.ericwitkowski.com/2013/05/an-introduction-to-querying-and.html