ssrs-2012 - 使用 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);
解决方案
不是创建服务请求,而是创建 Web 引用解决了这个问题。
我使用以下链接中的步骤将 Web 引用添加到 Visual Studio 项目: https ://www.codeproject.com/Articles/43133/Deploying-Reports-in-Reporting-Services-Programmat
推荐阅读
- swift - 使用列表中的 .onDelete 从 CoreData 关系中删除项目
- php - 如何在 WordPress 查询中查询相关产品帖子标题而不是整个帖子对象数组?
- python - 分隔包含一组或两组括号的字符串列
- sql - 从众多类别中选择仅属于一个类别的行
- javascript - 如何在shopify中带来最后一次用户购买?
- python - 检查Python中的多键字典中是否存在集合的元素?
- php - 如何在 Laravel 中将产品数组的价格与其数量相加
- java - 在 LibGDX 中设置窗口模式分辨率会出错
- angular - Angular CKEditor无法使用所需值设置数据属性
- neo4j - 合并时面临 IndexEntryConflictException