112
|
1 using System;
|
|
2 using System.Security.Principal;
|
|
3 using SSRS.Services.DTOs;
|
|
4 using SSRS.Services.ReportExecutionServiceReference;
|
|
5 using ServiceStack.ServiceHost;
|
|
6
|
|
7 namespace SSRS.Services
|
|
8 {
|
|
9 public class ReportExecutionService : IService<ReportExecutionRequest>
|
|
10 {
|
|
11 public object Execute(ReportExecutionRequest request)
|
|
12 {
|
|
13 string encoding = String.Empty, mimeType = String.Empty, extension = String.Empty;
|
|
14 Warning[] warnings = null;
|
|
15 string[] streamIDs = null;
|
|
16 ServerInfoHeader serverInfoHeader;
|
|
17 ExecutionInfo executionInfo1, executionInfo2;
|
|
18
|
|
19 var reportExecutionClient = new ReportExecutionServiceSoapClient();
|
|
20 reportExecutionClient.ClientCredentials.Windows.AllowedImpersonationLevel = TokenImpersonationLevel.None;
|
|
21
|
|
22 var executionHeader = reportExecutionClient.LoadReport(null, request.Name, null, out serverInfoHeader, out executionInfo1);
|
|
23
|
|
24 reportExecutionClient.SetExecutionParameters(executionHeader, null, Converter.Convert(request.Parameters), "en-us", out executionInfo2);
|
|
25 byte[] result;
|
|
26 reportExecutionClient.Render(executionHeader, null, request.Format, null, out result,
|
|
27 out extension, out encoding, out mimeType, out warnings, out streamIDs);
|
|
28
|
|
29 return new ReportExecutionResponse { Result = result };
|
|
30 }
|
|
31 }
|
|
32 } |