Can I get some help in utilizing the ReportExecutionService to execute my SSRS script

1

Here is my console app code:

private static void CreateSSRSPDF()
{
    string FullFilePath = "C:\\NewIbidReport";

    ReportExecutionService rs = new ReportExecutionService();

    string format = "PDF";
    string reportPath = "http://bushssrs02dev/ReportServer/Sam%20"+"-"+"%20Student%20Reports/IBid%20Audit%20Analysis.rdl";
    string mimeType = "application/pdf";

    ParameterValue[] parameters = new ParameterValue[1];
    parameters[0] = new ParameterValue();
    parameters[0].Name = "StudentStatus";
    parameters[0].Value = "Active";

    byte[] results = RenderReport(rs, format, mimeType, reportPath, parameters);
    WriteFile(results, FullFilePath);
}

private static byte[] RenderReport(ReportExecutionService rs, string format, string mimeType, string reportPath, ParameterValue[] parameters)
{
    rs.Credentials = System.Net.CredentialCache.DefaultCredentials;

    //Prepare Render arguments
    string historyID = null;
    string deviceInfo = String.Empty;
    string extension = String.Empty;
    string encoding = String.Empty;
    Warning[] warnings = null;
    string[] streamIDs = null;
    byte[] results = null;

    rs.LoadReport(reportPath, historyID);
    rs.SetExecutionParameters(parameters, "en-us");
    results = rs.Render(format, deviceInfo, out extension, out mimeType, out encoding, out warnings, out streamIDs);

    return results;
} 

The line rs.LoadRedport line is throwing an error:

System.Web.Services.Protocols.SoapException
  HResult=0x80131501
  Message=The path of the item 'http://bushssrs02dev/ReportServer/Sam%20-%20Student%20Reports/IBid%20Audit%20Analysis.rdl' is not valid. The full path must be less than 260 characters long; other restrictions apply. If the report server is in native mode, the path must start with slash. ---> Microsoft.ReportingServices.Diagnostics.Utilities.InvalidItemPathException: The path of the item 'http://bushssrs02dev/ReportServer/Sam%20-%20Student%20Reports/IBid%20Audit%20Analysis.rdl' is not valid. The full path must be less than 260 characters long; other restrictions apply. If the report server is in native mode, the path must start with slash.
  Source=System.Web.Services
  StackTrace:
   at System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall)
   at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)
   at MyServices.MyReportSerivce.ReportExecutionService.LoadReport(String Report, String HistoryID) in c:\users\prykiel\source\repos\Factodo399\MyServices\Web References\MyReportSerivce\Reference.cs:line 287
   at Factodo399.Program.RenderReport(ReportExecutionService rs, String format, String mimeType, String reportPath, ParameterValue[] parameters) in c:\users\prykiel\source\repos\Factodo399\Factodo399\Program.cs:line 53
   at Factodo399.Program.CreateSSRSPDF() in c:\users\prykiel\source\repos\Factodo399\Factodo399\Program.cs:line 36
   at Factodo399.Program.Main(String[] args) in c:\users\prykiel\source\repos\Factodo399\Factodo399\Program.cs:line 16

I can type this URL for the report path in a browser and execute the SSRS report, but I would like to execute it from a console app.

c#
reporting-services
asked on Stack Overflow Dec 9, 2019 by Paul T. Rykiel • edited Dec 9, 2019 by rene

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0