Presentation is loading. Please wait.

Presentation is loading. Please wait.

Windows Azure SQL Reporting for App developers

Similar presentations


Presentation on theme: "Windows Azure SQL Reporting for App developers"— Presentation transcript:

1 Windows Azure SQL Reporting for App developers
Using Windows Azure SQL Reporting you can publish a report in Windows Azure. Developers could use published reports in their apps via Report Viewer Control or SRSS SOAP API

2 Mihail Mateev About ... Mihail Mateev is a Senior Technical Evangelist, Evangelism and Community Lead at Infragistics Inc, Windows Azure MVP He works in various areas related to Microsoft technologies: Windows Azure, SQL Server, EF, WCF, LightSwitch, WPF, Silverlight, ASP.Net MVC..

3 Sponsors

4 Welcome!

5 Introduction This talk is about:
How to create Azure SQL Reporting Service How to deploy a report server project to Windows Azure SQL Reporting SQL Server Reporting vs. Azure SQL Reporting for developers How application developers can integrate reports hosted by Windows Azure SQL Reporting in their applications

6 SQL Server Reporting Services
SQL Server Reporting Services (SSRS) is a server-based report generation software system from Microsoft. Administered via a web interface, it can be used to prepare and deliver a variety of interactive and printed reports.

7 Creating the Report Project
SQL Server Data Tools Report Server Project Report Controls Spatial Data Source

8 Migrate SQL Server Report to SQL Azure Report
First you need to migrate your SQL Server database to SQL Azure Migrate Your data (SQL Server to Windows Azure SQL Database) Convert your Reporting Service project to use SQL Azure as Data Source Publish reports to SQL Azure Reporting Server

9 Deployment Select TargetServer URL

10 Developing a Report in BITS
Create a Report Create a new Reporting Server Project. Add a Report Add a new data source Provide the query for fetching the record from database

11 Developing a Report in BITS
Create a Report Select TargetServer URL Publish the Project/Report Verify the Reports in SQL Azure Reporting Service

12 Windows Azure SQL Reporting
Windows Azure SQL Reporting works the same as SQL Server Reporting Service – but runs on cloud with some limitations such as it connects only with SQL Azure database. Preparing a database. Creating a New SQL Azure Reporting Server Developing a Report in BITS Using Spatial Data with Windows Azure SQL Reporting Publishing Reports

13 Preparing a Database Windows Azure SQL Database
Create a new SQL Windows Azure Database server Set Firewall Rules Import Spatial Data

14 Creating a New Azure SQL Reporting Server
Windows Azure SQL Reporting Server Create a new Azure SQL Reporting Server. Get the Web Service URL

15 New Azure SQL Reporting Features
Since 1 of Februrary 2013 the price for Windows Azure SQL Reporting will decrease from $0.88 per hour for every 200 reports to $0.16 per hour for every 30 reports. Since 1 of March you can create and manage SQL Reporting Services from within the Windows Azure management portal (previously this was not supported in the new HTML portal).

16 Creating a New Azure SQL Reporting Server (new HTML Portal)
Create a new Azure SQL Reporting Server. Get the Web Service URL

17 Demo Create a report with spatial data from Bing Maps, Windows Azure SQL Database spatial data using Windows Azure SQL Reporting

18 SQL Reporting for App Developers.
Integrating Reports into Custom Applications Leveraging URL access and Web services to render reports Building a custom Windows Forms application to enter parameters and render reports Integrating report viewer controls in Windows and web form applications Rendering reports from within your web applications as HTML or as other downloadable formats such as PDF Creating custom parameter input interfaces for Reporting Services

19 SQL Reporting for App Developers
Create a Report Server Project

20 SQL Reporting for App Developers
Leveraging URL access and Web services to render reports protocol://server/virtualroot?[/pathinfo]&prefix:param=value [&prefix:param=value] n]

21 SQL Reporting for App Developers
Leveraging URL access and Web services to render reports function open_win() { window.open(" SpatialDataReport/SpatialReport&rs:Command=Render") }

22 SQL Reporting for App Developers
ReportViewer Control in a Web application Create a new Microsoft ASP.NET Web Site / Web Application Add a ReportViewer Control

23 SQL Reporting for App Developers
ReportViewer Control in a ASP.Net MVC Apps Add a WebForm with ReportViewer control in your ASP.Net MVC project and add a custom route Use Reponse.Redirect(url) in MVC Controller Use WebClient and use SRSS url in Controller Use ReportViewer and FileResult in Controller MVC .aspx view and .rdlc project (client side rendering). SRSS SOAP API

24 SQL Reporting for App Developers
ReportViewer Control in a ASP.Net MVC Apps

25 Viewing SSRS Reports in an ASP.net MVC
ReportViewer in an ASP.Net MVC ReportViewer control won't work if you place it in an MVC view, since it requires ViewState. You'll have to create s web form and put the ReportViewer there. you can have a web forms pages which have server controls in them mixed in with your MVC site. .

26 SQL Reporting for App Developers
Add a custom route in MVC Apps Apps MVC 3 – Global.asax.cs MVC 4 – RouteConfig.cs //Custom route for reports routes.MapPageRoute( "ReportRoute", // Route name "Reports/{reportname}", // URL "~/Reports/{reportname}.aspx" // File );

27 SQL Reporting for App Developers
Add code in your .aspx file <rsweb:ReportViewer ID="ReportViewer1" runat="server" ProcessingMode="Remote“> </rsweb:ReportViewer>

28 SQL Reporting for App Developers
Add code in your .aspx file protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) ReportViewer1.ServerReport.ReportServerUrl = new Uri(String.Format(" ConfigurationManager.AppSettings["SERVER_NAME"])); ReportViewer1.ServerReport.ReportServerCredentials = new ReportServerCredentials( ConfigurationManager.AppSettings["USERNAME"], ConfigurationManager.AppSettings["PASSWORD"], ConfigurationManager.AppSettings["SERVER_NAME"]); }

29 SQL Reporting for App Developers
USE Response.Redirect in the MVC Controller string reportURL /Pages/ReportViewer.aspx?/<report_definition>& rs:Command=Render&rs:Format=PDF"; Response.Redirect(reportURL);

30 SQL Reporting for App Developers
USE WebClient in the MVC Controller string uriDownload = new Uri(" ReportViewer.aspx?/<report_definition>& rs:Command=Render&rs:Format=PDF"); string strSavePath client.DownloadFile(uriDownload, strSavePath); System.Diagnostics.Process.Start(strSavePath);

31 SQL Reporting for App Developers
Use ReportViewer and FileResult in Controller public FileResult File() { ReportViewer rv = new Microsoft.Reporting.WebForms.ReportViewer(); rv.ProcessingMode = ProcessingMode.Local; .... rv.LocalReport.ReportPath = Server.MapPath("<report_project_path>"); return File(streamBytes, mimeType, "TestReport.pdf"); }

32 SQL Reporting for App Developers
Use ReportViewer and FileResult in Controller public FileResult File() { ReportViewer rv = new Microsoft.Reporting.WebForms.ReportViewer(); rv.ProcessingMode = ProcessingMode.Local; .... rv.LocalReport.ReportPath = Server.MapPath("<report_project_path>"); return File(streamBytes, mimeType, "TestReport.pdf"); }

33 SQL Reporting for App Developers
MVC .aspx view and .rdlc project (client side rendering) private void Page_Load(object sender, System.EventArgs e) { ReportViewer1.LocalReport.ReportPath = Server.MapPath("../Path/MyReport.rdlc"); ReportViewer1.LocalReport.DataSources.Clear(); ReportDataSource rds = new ReportDataSource(); rds.Name = "DataSet1"; rds.Value = SqlDataSource1; ReportViewer1.LocalReport.DataSources.Add(rds); ReportViewer1.LocalReport.Refresh(); }

34 SQL Reporting for App Developers
SRSS SOAP API private void Page_Load(object sender, System.EventArgs e) { ReportingService2005 rs = new ReportingService2005(); rs.Credentials = System.Net.CredentialCache.DefaultCredentials; CatalogItem[] items = rs.ListChildren("/", true); foreach(CatalogItem ci in items) if (ci.Type == ItemTypeEnum.Report) catalogListBox.Items.Add(ci.Path); }

35 Azure SQL Reporting for App Developers
Azure SQL Reporting for WEB Apps ReportViewer Control in a ASP.Net Web Forms Apps ReportViewer Control in a ASP.Net MVC Apps Add a WebForm with ReportViewer control in your ASP.Net MVC project and add a custom route SRSS SOAP API

36 Azure SQL Reporting for App Developers
ReportViewer Control should be in Remote Processing Mode. When to Use Remote Processing Report can be accessed by many users Report has a very complex query or contains a very large amount of data Report is already published on a report server

37 Azure SQL Reporting for App Developers
Authentication to SQL Reporting Integrated authentication <!-- Web.config file. --> <identity impersonate="true"/> Custom authentication extension to provide a forms authentication interface Supply the SQL Reporting credentials in the way supported by the forms authentication extension

38 SQL Reporting for App Developers
public class ReportServerCredentials : IReportServerCredentials { private string _userName; private string _password; private string _domain; public ReportServerCredentials(string userName, string password, string domain) _userName = userName; _password = password; _domain = domain; } //implementation....

39 SQL Reporting for App Developers
public bool GetFormsCredentials (out Cookie authCookie, out string user, out string password, out string authority) { // Do not use forms credentials to authenticate. authCookie = null; user = password = authority = null; return false; }

40 SQL Reporting for App Developers
Set credentials for ReportViewer Settings <!-- Web.config file. --> <appSettings> <add key="SERVER_NAME" value=“<SERVER NAME>"/> <add key="USERNAME" value=“<USER>"/> <add key="PASSWORD" value=“<PASSWORD>"/> <add key="REPORT_PATH“ value="/SpatialDataReport/Report1"/> </appSettings> Set Report parameters

41 Azure SQL Reporting for App Developers
ReportViewer Control in a ASP.Net MVC Add code in your .aspx file protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) ReportViewer1.ServerReport.ReportServerUrl = new Uri(String.Format(" ConfigurationManager.AppSettings["SERVER_NAME"])); ReportViewer1.ServerReport.ReportPath = ConfigurationManager.AppSettings["REPORT_PATH"]; ReportViewer1.ServerReport.ReportServerCredentials = new ReportServerCredentials(); }

42 SQL Reporting for App Developers
SRSS SOAP API The SQL Reporting SOAP API provides several Web service endpoints for developing custom reporting solutions. The management functionality is exposed through the ReportService2005 Namespace and ReportService2010 Namespace endpoints.

43 SQL Reporting for App Developers
SRSS SOAP API Generate a proxy class Open the Visual Studio Command Prompt and run the wsdl.exe command to generate the proxy class. For example: wsdl /language:CS /n:"ReportServices2010" In Visual Studio, add the generated .cs file to your project.

44 SQL Reporting for App Developers
SRSS SOAP API Access published repots ReportingService2010 rs = new ReportingService2010(); rs.Url = String.Format(" ConfigurationManager.AppSettings["SERVER_NAME"]); rs.CookieContainer = new CookieContainer(); rs.LogonUser(ConfigurationManager.AppSettings["USERNAME"], ConfigurationManager.AppSettings["PASSWORD"], ConfigurationManager.AppSettings["SERVER_NAME"]); CatalogItem[] items = rs.ListChildren("/", true);

45 SQL Reporting for App Developers
DEMO

46 ReportViewer in a Windows Azure Web Site
Incorporate ReportViewer into your Windows Azure application Include the needed assemblies in the deployment package Configure authentication and authorization appropriately.

47 ReportViewer in a Windows Azure Web Site
Authentication to SQL Reporting SQL Reporting uses cookie-based authentication. Each cookie expires after one hour. The report server sends a new cookie to the client every half-hour. The client code must explicitly save new cookies sent by the server and return them with subsequent requests.

48 ReportViewer in a Windows Azure Web Site
Authentication to SQL Reporting SQL Reporting implements a custom authentication extension to provide a forms authentication interface

49 ReportViewer in a Windows Azure Web Site
Use the IReportServerCredentials to access SQL Reporting reports: ASP.Net WEB Forms Page.

50 ReportViewer in a Windows Azure Web Site
ReportViewer controls are shipped with Visual Studio 2010 /2012 , Standard Edition or above ReportViewer configured in local processing mode is not supported in Windows Azure.

51 ReportViewer in a Windows Azure Web Site
In remote processing mode, the ReportViewer control uses Microsoft.ReportViewer.WebForms.dll (ASP.Net Page) Microsoft.ReportViewer.Common.dll Used at run time. It is not automatically added to your project.

52 ReportViewer in a Windows Azure Web Site
Make assemblies locally accessible by your ASP.Net application

53 Thank you!

54 Q & A

55 Sponsors:

56 For more Information mmateev@infargistics.com michael@mateev.net
@mihailmateev


Download ppt "Windows Azure SQL Reporting for App developers"

Similar presentations


Ads by Google