java - 使用 JAVA 和 SOAP Web 服务的 SSRS 呈现报告

标签 java web-services sql-server-2008 soap reporting-services

我正在使用 SQL Server 开发 Java Web 应用程序和报告服务器,我想知道是否可以使用 SOAP Web 服务将报告从 SSRS 呈现到我的 Java 应用程序。

我正在使用SSRS-API获取有关我的 SSRS 的信息,例如文件夹名称、报告名称……但我无法呈现我的报告或以 PDF 或其他扩展形式上传。

有什么建议吗?

谢谢

编辑

我使用了上面提到的SSRS api的下载功能(downloadReport)(SSRS-API),这里是该功能的代码:

public void downloadReport(final String path, final String filename) {
    final File file = new File(filename);
    final String physicalName = toPhysicalFileName(path);

    info("Downloading Report with symbolic name " + path + " to " + file);

    final byte[] data = _soap.getReportDefinition(physicalName);

    try (final FileOutputStream out = new FileOutputStream(file)) {
        out.write(data);
    } catch (final IOException ioe) {
        final String message = "Failed to download report with symbolic name " + path + " to " + file;
        LOG.warning(message);
        if (file.exists() && !file.delete()) {
            throw new IllegalStateException(message + " and failed to delete temporary file", ioe);
        } else {
            throw new IllegalStateException(message, ioe);

        }
    }
}

这是我用来调用此函数的函数:

public void downloadReport() {
    ssrs.downloadReport('Path/Report name', 'C:\\PATH\\TO\\A\\FOLDER\\REPORT.XML');
}

在给定路径 (C:/PATH/TO/A/FOLDER/REPORT.XML) 中,我得到一个如下所示的 XML 文件:

<?xml version="1.0" encoding="utf-8"?>
<Report xmlns:rd="http://schemas.microsoft.com/SQLServer/reporting/reportdesigner" xmlns:cl="http://schemas.microsoft.com/sqlserver/reporting/2010/01/componentdefinition" xmlns="http://schemas.microsoft.com/sqlserver/reporting/2010/01/reportdefinition">
  <AutoRefresh>0</AutoRefresh>
  <DataSources>
    <DataSource Name="PercallAnalysisDW">
      <DataSourceReference>Entrepôt de données Percall Analysis</DataSourceReference>
      <rd:SecurityType>None</rd:SecurityType>
      <rd:DataSourceID>3a3e3aa4-c6d6-4b44-80f0-f18a9ecd2eac</rd:DataSourceID>
    </DataSource>
  </DataSources>
  <DataSets>
    <DataSet Name="DeliveryMarginCumuleDS">
      <SharedDataSet>
        <SharedDataSetReference>DeliveryMarginCumuleDS</SharedDataSetReference>
      </SharedDataSet>
      <Fields>
        <Field Name="Date">
          <DataField>Date</DataField>
          <rd:TypeName>System.String</rd:TypeName>
        </Field>
        <Field Name="Projet">
          <DataField>Projet</DataField>
          <rd:TypeName>System.String</rd:TypeName>
        </Field>
        <Field Name="LABOR_facturé">
          <DataField>LABOR_facturé</DataField>
          <rd:TypeName>System.Int32</rd:TypeName>
        </Field>
        <Field Name="TL_facturé">
          <DataField>TL_facturé</DataField>
          <rd:TypeName>System.Int32</rd:TypeName>
        </Field>
        <Field Name="Coût_total">
          <DataField>Coût_total</DataField>
          <rd:TypeName>System.Int32</rd:TypeName>
        </Field>
        <Field Name="DM">
          <DataField>DM</DataField>
          <rd:TypeName>System.Int32</rd:TypeName>
        </Field>
        <Field Name="Revenu">
          <Value>=Fields!LABOR_facturé.Value + Fields!TL_facturé.Value</Value>
        </Field>
      </Fields>
    </DataSet>
  </DataSets>
  <ReportSections>
    <ReportSection>
      <Body>
        <ReportItems>
          <Tablix Name="Tablix1">
            <TablixBody>
                ...

最佳答案

这是来自 another answer 的文章,但请注意,这是 2005 年的: JavaWorld 。这是 MSDN 上类似问题的答案董事会:

"However, report viewer control is only supported in the .Net application. So it is unlikely to integrate the reports with the java based front end without having to launch new browser pages. My suggestion is to use URL access to the reports in the Web Application. However, if you do so, the report will be opened in the new browser page."

关于java - 使用 JAVA 和 SOAP Web 服务的 SSRS 呈现报告,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39597453/

相关文章:

java - 来自 hikaricp 连接池的连接对象

java - 将 Java Web 项目部署到物理服务器

.net - 通过 Web 服务上传文件

sql - 无法在 where 子句中使用临时列?

sql - 有没有工具可以检查一组sql所需的最低权限?

sql-server-2008 - IFF 语句错误 '=' 附近的语法不正确

java - 如何使用 .contains 方法检查整数值是否在二维数组中?

java - 如何通过所有项目找到某一类型的任务?

java - 从 servlet 中的查询结果返回 XML

c# - 当我尝试在 Visual Studio 2010 中添加 Web 服务时遇到问题