Wednesday, March 7, 2012

ReportingService.Render

Hi All,
In the examples of the ReportingService API i found the render method that
renders a report to a file.
But what ever i try i cant get it to work becuase the reportPath parameter
is always incorrect.
When browsing for the report using my IE browser this is the URL:
http://localhost/ReportServer?%2ftester1%2fReport1&rs:Command=Render
I come there after typing in:
http://localhost/ReportServer
Then clicking on tester1
Then clicking on report1
Now what ever i try to put in the reportPath it does not work. Can someone
give me any pointers?
Dim rs As New ReportingService.ReportingService
rs.Credentials = System.Net.CredentialCache.DefaultCredentials
' Render arguments
Dim result As Byte() = Nothing
Dim reportPath As String = "/ReportServer/tester1/report1"
Dim format As String = "MHTML"
Dim historyID As String = Nothing
Dim devInfo As String = "<DeviceInfo><Toolbar>False</Toolbar></DeviceInfo>"
' Prepare report parameter.
Dim parameters() As ParameterValue = Nothing
Dim credentials As DataSourceCredentials() = Nothing
Dim showHideToggle As String = Nothing
Dim encoding As String
Dim mimeType As String
Dim warnings As Warning() = Nothing
Dim reportHistoryParameters As ParameterValue() = Nothing
Dim streamIDs As String() = Nothing
Dim sh As New SessionHeader
rs.SessionHeaderValue = sh
Try
result = rs.Render(reportPath, format, historyID, devInfo,
parameters, credentials, showHideToggle, encoding, mimeType,
reportHistoryParameters, warnings, streamIDs)
sh.SessionId = rs.SessionHeaderValue.SessionId
Catch e As SoapException
End Try
Try
Dim stream As FileStream = File.Create("report.pdf",
result.Length)
stream.Write(result, 0, result.Length)
stream.Close()
Catch e As Exception
End Try/tester1/report1 as path solved that problem.
But now i have other problems with the user compname\ASP.NET not having
sufficient rights.
Where can i find documentation on how to setup the security so that i can
use the render method?

No comments:

Post a Comment