SSRS Render reports using JAVA and SOAP Web Service

I am working on a Java Web Application and a Reporting Server using SQL Server and I wanna know if its possible to render Reports from SSRS to my Java Application using the SOAP Web Service.

I am using the SSRS-API to get information about my SSRS like folders name, reports name, ... but I am not able to render my reports or upload it in PDF or other extensions.

Any suggestion?

Thanks

EDIT

I used the download function (downloadReport) of SSRS api I mentioned above (SSRS-API), here is the code of the function :

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);

        }
    }
}

And here is the function that I use call this function :

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

And in the given path (C:/PATH/TO/A/FOLDER/REPORT.XML) I get an XML file like this :

<?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>
                ...

Answers


Here's an article from another answer, but be aware that it's from 2005: JavaWorld. And here's an answer from a similar question on a MSDN board:

"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."


I solved the problem by generating reports with URL, here is the function that allows me to generate reports :

public void downloadReportExcel(String path) {
    try {
        String url = "http://" + SSRS_IP + "/ReportServer?/" + path + "&rs:Format=Excel";

        FacesContext.getCurrentInstance().getExternalContext().redirect(url);

        return;
    } catch (IOException e) {
        throw new FacesException(e);
    }
}

The function get a path in parameters and redirect me to the server url with 2 parameters:

  • ?/path : is the full path (from the root folder) of the report to generate
  • rs:Format=Excel : is the format of the generation (here I want to export the report to Excel, but It can take PDF, like : &rs:Format=PDF)

thanks for your help @RussellFox, I will give a try for the .NET solution


Need Your Help

Data races, UB, and counters in C++11

c++ multithreading c++11 memory-model

The following pattern is commonplace in lots of software that wants to tell its user how many times it has done various things: