首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >部署Reporting Services解决方案

部署Reporting Services解决方案
EN

Stack Overflow用户
提问于 2012-07-24 05:51:17
回答 1查看 1.8K关注 0票数 1

我正在为客户编写Reporting Services解决方案。我正在我的开发环境中开发这个解决方案,并且没有访问客户站点的权限。我正在寻找一种方法来打包我的Reporting Services解决方案。我想要一些类型的安装部署包,可以帮助他们在安装过程中指定他们的生产数据源。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2012-07-24 06:56:59

没有内置的。

  1. 你需要创建一个dll项目并编写一个自定义的安装程序动作。参见Walkthrough: Creating a Custom Action获取示例。
  2. 您的dll需要包含对http://SsrsServer.mydomain.tld/ReportServer/ReportService2005.asmx的web服务引用。请参阅How to: Add a Reference to a Web Service.
  3. You'll需要在安装程序中添加自定义对话框,以询问报表服务器部署位置。有关如何创建和使用自定义dialog.
  4. You'll的示例,请参见Report.
  5. You'll需要自定义对话框来获取报表所在的文件夹需要以编程方式更改web服务引用的destination.
  6. You'll需要进行适当的web服务调用来创建DataSource.
  7. You'll需要进行适当的web服务调用来创建Report.
  8. You‘ll需要将报表绑定到DataSource。

您将需要的报告服务web服务在ReportingService2005 Class中提供了文档。下面是这些操作的一些示例代码:

代码语言:javascript
复制
    /// <summary>
    /// Gets the reporting service SOAP client with the specified report server URL.
    /// </summary>
    /// <param name="reportServerUrl">The report server URL.</param>
    /// <returns>An instance of the reporting service SOAP client.</returns>
    internal static ReportingService2005SoapClient GetReportingService2005(Uri reportServerUrl)
    {
        EndpointAddress endPoint = new EndpointAddress(reportServerUrl);
        ReportService2005.ReportingService2005SoapClient soapClient = new ReportService2005.ReportingService2005SoapClient("ReportingService2005Soap", endPoint);
        soapClient.ClientCredentials.Windows.AllowedImpersonationLevel = System.Security.Principal.TokenImpersonationLevel.Impersonation;

        return soapClient;
    }

    /// <summary>
    /// Creates the data source.
    /// </summary>
    /// <param name="reportServerUri">The report server URI.</param>
    /// <param name="parentPath">The parent path.</param>
    /// <param name="itemName">Name of the item.</param>
    /// <param name="dataSourceDefinition">The data source definition.</param>
    internal static void CreateDataSource(Uri reportServerUri, string parentPath, string itemName, string description, DataSourceDefinition dataSourceDefinition)
    {
        using (ReportingService2005SoapClient reportingService = GetReportingService2005(reportServerUri))
        {
            ServerInfoHeader serverInfo = null;
            try
            {
                Property[] props = CreateDescriptionProperty(description);
                serverInfo = reportingService.CreateDataSource(null, itemName, parentPath, true, dataSourceDefinition, props);
            }
            catch (FaultException ex)
            {
                Trace.WriteLine(string.Format("CreateDataSource {0}/{1}: {2}", parentPath, itemName, ex.Message));
            }
        }
    }

    /// <summary>
    /// Creates the report.
    /// </summary>
    /// <param name="reportServerUri">The report server URI.</param>
    /// <param name="parentPath">The parent path.</param>
    /// <param name="itemName">Name of the item.</param>
    /// <param name="reportDefinition">The report definition.</param>
    internal static void CreateReport(Uri reportServerUri, string parentPath, string itemName, string description, byte[] reportDefinition)
    {
        Warning[] warnings;

        using (ReportingService2005SoapClient reportingService = GetReportingService2005(reportServerUri))
        {
            ServerInfoHeader serverInfo = null;
            try
            {
                Property[] props = CreateDescriptionProperty(description);
                serverInfo = reportingService.CreateReport(null, itemName, parentPath, true, reportDefinition, props, out warnings);
            }
            catch (FaultException ex)
            {
                Trace.WriteLine(string.Format("CreateReport {0}/{1}: {2}", parentPath, itemName, ex.Message));
            }
        }
    }

    /// <summary>
    /// Set the report or model data sources on the reporting server from the provided data source map entries.
    /// </summary>
    /// <param name="reportServerUri">The report server URI.</param>
    /// <param name="itemPath"></param>
    /// <param name="dataSourceMapEntries"></param>
    internal static void SetItemDataSourceMap(Uri reportServerUri, string itemPath, Dictionary<string, string> dataSourceMapEntries)
    {
        DataSource[] dataSources = (from dataSourceMapEntry in dataSourceMapEntries
                                    where !string.IsNullOrEmpty(dataSourceMapEntry.Value)
                                    select ConvertDataSourceMapEntry(dataSourceMapEntry)).ToArray();

        using (ReportingService2005SoapClient reportingService = GetReportingService2005(reportServerUri))
        {
            ServerInfoHeader serverInfo = null;
            try
            {
                serverInfo = reportingService.SetItemDataSources(null, itemPath, dataSources);
            }
            catch (FaultException ex)
            {
                Trace.WriteLine(string.Format("SetItemDataSourceMap {0} {1}", itemPath, ex.Message));
            }
        }
    }

    /// <summary>
    /// Convert a data source map entry into a report server data source object.
    /// </summary>
    /// <param name="dataSourceMapEntry"></param>
    /// <returns></returns>
    private static DataSource ConvertDataSourceMapEntry(KeyValuePair<string, string> dataSourceMapEntry)
    {
        DataSource dataSource = new DataSource();
        DataSourceReference dataSourceReference = new DataSourceReference();
        dataSource.Name = dataSourceMapEntry.Key;
        dataSourceReference.Reference = dataSourceMapEntry.Value;
        dataSource.Item = dataSourceReference;
        return dataSource;
    }
票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/11621095

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档