You can upload all types of developer-created ActiveReports to the server using the UploadResource method. This topic explains how to upload a code-based section report.
Paste in the Address box, replacing 8080 with the site port where you installed ActiveReports 12 Server. |
Copy Code
|
---|---|
http://localhost:8080/ReportService.svc |
Confirm the value of address attribute in the endpoint element of the app.config file |
Copy Code
|
---|---|
<client> |
Visual Basic
Visual Basic code (Add to the list of Imports statements at the top of the code.) |
Copy Code
|
---|---|
Imports System.IO Imports UploadReport.ReportService |
C#
C# code(Add to the list of using statements at the top of the code.) |
Copy Code
|
---|---|
using System.IO; using UploadReport.ReportService; |
Visual Basic
Visual Basic code (Paste the following code into the Main method of the Module1 module declaration) |
Copy Code
|
---|---|
Dim filepath As String = "C:\section_report.rpx" Dim serverUserName = "USER" Dim serverUserPwd = "PASS" Dim uploadOptions = New UploadOptions() With { _ .Overwrite = True _ } Dim reportService = New ReportServiceClient("WSHttpBinding_IReportService") Dim securityToken = reportService.Login(serverUserName, serverUserPwd, Nothing, True) ' Name: Report name to display after the upload. ' ReportType: Type of the report to upload. ' ClassName: Class name. Specify while uploading code-based section report. ' AssemblyResourceId: Assembly Resource ID. Specify while uploading code-based section report. Dim reportDescription As New ReportDescription() With reportDescription .Name = "Test Report" .ReportType = ReportType.SectionReport .ClassName = Nothing .AssemblyResourceId = Nothing End With reportService.UploadResource(securityToken, ReportDescription, Convert.ToBase64String(File.ReadAllBytes(filepath)), UploadOptions) |
C#
C# code (Paste the following code into the Main method of the Program class declaration) |
Copy Code
|
---|---|
string filepath = @"C:\section_report.rpx"; var serverUserName = "USER"; var serverUserPwd = "PASS"; var uploadOptions = new UploadOptions { Overwrite = true }; var reportService = new ReportServiceClient("WSHttpBinding_IReportService"); var securityToken = reportService.Login(serverUserName, serverUserPwd, null, true); // Name: Report name to display after the upload. // ReportType: Type of the report to upload. // ClassName: Class name. Specify while uploading code-based section report. // AssemblyResourceId: Assembly Resource ID. Specify while uploading code-based section report. var reportDescription = new ReportDescription() { Name = "Test Report", ReportType = ReportType.SectionReport, ClassName = null, AssemblyResourceId = null }; reportService.UploadResource(securityToken, reportDescription, Convert.ToBase64String(File.ReadAllBytes(filepath)), uploadOptions); |