diff SSRS/SSRS.Services/ReportExecution.cs @ 112:b9d5f934cb21

Initial upload
author adminsh@apollo
date Sat, 19 May 2012 16:09:07 +0100
parents
children e51a6af1c98d
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SSRS/SSRS.Services/ReportExecution.cs	Sat May 19 16:09:07 2012 +0100
@@ -0,0 +1,32 @@
+using System;
+using System.Security.Principal;
+using SSRS.Services.DTOs;
+using SSRS.Services.ReportExecutionServiceReference;
+using ServiceStack.ServiceHost;
+
+namespace SSRS.Services
+{
+    public class ReportExecutionService : IService<ReportExecutionRequest>
+    {
+        public object Execute(ReportExecutionRequest request)
+        {
+            string encoding = String.Empty, mimeType = String.Empty, extension = String.Empty;
+            Warning[] warnings = null;
+            string[] streamIDs = null;
+            ServerInfoHeader serverInfoHeader;
+            ExecutionInfo executionInfo1, executionInfo2;
+
+            var reportExecutionClient = new ReportExecutionServiceSoapClient();
+            reportExecutionClient.ClientCredentials.Windows.AllowedImpersonationLevel = TokenImpersonationLevel.None;
+
+            var executionHeader = reportExecutionClient.LoadReport(null, request.Name, null, out serverInfoHeader, out executionInfo1);
+
+            reportExecutionClient.SetExecutionParameters(executionHeader, null, Converter.Convert(request.Parameters), "en-us", out executionInfo2);
+            byte[] result;
+            reportExecutionClient.Render(executionHeader, null, request.Format, null, out result,
+                                            out extension, out encoding, out mimeType, out warnings, out streamIDs);
+
+            return new ReportExecutionResponse { Result = result };
+        }
+    }
+}
\ No newline at end of file