首页 > 解决方案 > 使用 ReportingService2010 的 CreateCatalogItem 错误

问题描述

我正在尝试使用 ReportingService2010 将数据集和报告部署到 SSRS。wsdl 定义显示了 CreateCatalogItem 的以下方法架构:

<s:element name="CreateCatalogItem">
  <s:complexType>
      <s:sequence>
         <s:element minOccurs="0" maxOccurs="1" name="ItemType" type="s:string" /> 
         <s:element minOccurs="0" maxOccurs="1" name="Name" type="s:string" /> 
         <s:element minOccurs="0" maxOccurs="1" name="Parent" type="s:string" /> 
         <s:element minOccurs="1" maxOccurs="1" name="Overwrite" type="s:boolean" /> 
         <s:element minOccurs="0" maxOccurs="1" name="Definition" type="s:base64Binary" /> 
         <s:element minOccurs="0" maxOccurs="1" name="Properties" type="tns:ArrayOfProperty" /> 
      </s:sequence>
   </s:complexType>
</s:element>

但是,在 C# 中,CreateCatalogItem 需要更多参数。参数如下:

在此处输入图像描述 所以额外的参数是 TrustedUserHeader 和 CatalogItem。我尝试将 null 传递给 TrustedUserHeader 并创建了一个名为 catalogItem 的变量。

我在尝试下面的代码时遇到的运行时错误是:

Server did not recognize the value of HTTP Header SOAPAction: http://schemas.microsoft.com/sqlserver/reporting/2010/03/01/ReportServer/CreateCatalogItem.

这是代码:

var rs = new ReportingService2010SoapClient(reportBinding.CreateHttpBinding(), new EndpointAddress(Helper.ReportURI));

rs.ClientCredentials.Windows.AllowedImpersonationLevel = TokenImpersonationLevel.Impersonation;
rs.ClientCredentials.Windows.ClientCredential = credentials.GetNetworkCredential();

string parent = @"http://servername/Reports/Pages/Folder.aspx?ItemPath=%2fReportTest&ViewMode=List";
Byte[] definition = null;
Warning[] warnings = null;
Property[] properties = null;
CatalogItem catalogItem;

rs.CreateCatalogItem(null, "Report", @"C:\temp\SelAcctDtl.rdl", parent, false, definition, properties, out catalogItem, out warnings);

标签: ssrs-2012soap-client

解决方案


不是创建服务请求,而是创建 Web 引用解决了这个问题。

我使用以下链接中的步骤将 Web 引用添加到 Visual Studio 项目: https ://www.codeproject.com/Articles/43133/Deploying-Reports-in-Reporting-Services-Programmat


推荐阅读