Deploying Reports in Reporting Services Programmatically
May be it's my bad luck may be something else, but I didn't find a complete post how to deploy Reports, and Data Sources in Reporting Services in away like BIDS.
First it's a tool I developed to automate the deployment of BI solution (Creating Data warehouse, installing SSIS packages, creating Jobs, create Cubes and installing reports on Reporting Services Server).
If you don't have time to read and just need to download the tool, here you're
Source Code: http://cid-3e2288e7a8e55f56.skydrive.live.com/self.aspx/Public%20folder/Deploying%20Reports%20in%20Reporting%20Services%20Programmatically.zip
Herein, I'll talk about the last thing which is deploying reports.
P.S: It's my way in designing such task (Installing reports on Reporting Services Server) and it's not standard or anything else just (follow your heart :))
Let's begin, I assume you, me, or anybody else has these 3 XML files one for folders, one for data sources and one for reports.
[caption id="attachment_772" align="aligncenter" width="450" caption="Folders' XML Scheme"][/caption]
Name: Folder name to be created on Reporting Services.
ParentFolder: '/' means on the top == no parent folder.
[caption id="attachment_773" align="aligncenter" width="450" caption="Data Sources' XML Scheme"][/caption]
Name: Data Source name to be created on Reporting Services.
Folder: The folder in which Data Source should be in, if we use '/' means on the top == no parent folder.
Description: Data Source Description.
HideInListView: True to hide it in the Reporting Services, otherwise False.
Enabled: True to be enabled, otherwise not enabled.
ConnectionString: Data Source connection string.
Extension: Configured according to the provider for more details see below table...Provider Extension Microsoft SQL Server SQL OLE DB OLEDB Microsoft SQL Server Analysis Services OLEDB-MD Oracle ORACLE ODBC ODBC XML XML SAP NetWeaver BI SAPBW Hyperion Essbase ESSBASE
CredentialRetrieval: How Data Source will retrieve the credential.
WindowsCredentials: True to use Windows credential otherwise it'd use the credential provided in this XML (Username, and Password).
ImpersonateUser: Indicates whether the report server attempts to impersonate a user by using stored credentials after a data processing extension has established an authenticated connection to a data source.
ImpersonateUserSpecified: Gets or sets a value that indicates whether the ImpersonateUser property is specified.
Prompt: Gets or sets the prompt that the report server displays to the user when prompting for credentials.
UserName: Gets or sets the user name that the report server uses to connect to a data source.
Password: Sets the password that the report server uses to connect to a data source. Write-only.
EnabledSpecified: Gets or sets a value that indicates whether the Enabled property is specified.
More details on these properties http://msdn.microsoft.com/en-us/library/reportservice2005.datasourcedefinition_properties.aspx
[caption id="attachment_774" align="aligncenter" width="450" caption="Reports' XML Scheme"][/caption]
Name: Report Name.
Path: .RDL file path.
Folder: The folder in which Report should be in, if we use '/' means on the top == no parent folder.
DataSource: Report's Data Source name of Reporting Services.
And these configuration keys
[caption id="attachment_777" align="aligncenter" width="450" caption="Configuration keys"][/caption]
ReportsXMLFilePath: Reports' XML File Path
DataSourcesXMLFilePath: Data Sources' XML File Path
FoldersXMLFilePath: Folders' XML File Path
ReportingServerURL: URL of Reporting Services
Open visual studio and create a C# console application (we don't need any interaction with user everything configured in the application configuration file)
From the project main menu Add Web Reference or Add Service Reference then Advanced then Add Web Reference...
[caption id="attachment_778" align="aligncenter" width="450" caption="Add Web Reference"][/caption]
[caption id="attachment_779" align="aligncenter" width="450" caption="Add Reporting Services Reference"][/caption]
URL: http://{Server-Name}/reportserver/ReportService.asmx
Web reference name: Give it meaningful name..
What we did is adding web service by which we can talk to Reporting Services to ask it to do something like (create report, create data source, etc...).
Let's write some very simple C# code
We have method called DeployReports this method calls 3 other methods in order (CreateFolders, CreateDataSources, and CreateReports)
No comments:
Post a Comment