Hello...
I am struggling with this...but I am getting close.
I am trying to use the Web Service programming interface from my ASP.Net
application. What I am trying to accomplish...is to allow the user to set
some report parameters (date ranges, zip codes, etc). When the user presses
the Run button on my ASP.Net page, I would like to render the report in a new
browser window/page, and with the Toolbar so the user could export to
whatever format that they want. Is this possible?
Thanks for any help...
- DW
The code I am using now is the following..
Dim rptIRIS As Byte() = Nothing
Dim rsIRIS As Secure_SQLRS.ReportingService = New
Secure_SQLRS.ReportingService
rsIRIS.Credentials = New System.Net.NetworkCredential("ME", "Pwd",
"Domain")
rsIRIS.PreAuthenticate = True
Dim rptPath As String = "/WebReports/UserLabels"
Dim rptFormat As String = "HTML4.0"
Dim rptViewerInfo As String = "<DeviceInfo>" & _
"<Toolbar>true</Toolbar>" & _
"<Parameters>false</Parameters>" & _
"<DocMap>true</DocMap>" & _
"<Zoom>100</Zoom>" & _
"</DeviceInfo>"
Dim rptParams(1) As Secure_SQLRS.ParameterValue
Dim paramValue As Secure_SQLRS.ParameterValue = New
Secure_SQLRS.ParameterValue
paramValue.Name = "ProductID"
paramValue.Value = "102"
rptParams(0) = paramValue
paramValue = New Secure_SQLRS.ParameterValue
paramValue.Name = "ZipCode"
paramValue.Value = "12345"
rptParams(1) = paramValue
Dim rptHistoryID As String = Nothing
Dim credentials() As Secure_SQLRS.DataSourceCredentials = Nothing
Dim showHideToggle As String = Nothing
Dim encoding As String
Dim mimeType As String
Dim warnings() As Secure_SQLRS.Warning = Nothing
Dim rptHistoryParams() As Secure_SQLRS.ParameterValue = Nothing
Dim streamIDs() As String = Nothing
Dim rptSessionHdr As Secure_SQLRS.SessionHeader = New
Secure_SQLRS.SessionHeader
rsIRIS.SessionHeaderValue = rptSessionHdr
Try
' execute the report
rptIRIS = rsIRIS.Render(rptPath, rptFormat, rptHistoryID,
rptViewerInfo, rptParams, credentials, _
showHideToggle, encoding, mimeType, rptHistoryParams,
warnings, streamIDs)
rptSessionHdr.SessionId = rsIRIS.SessionHeaderValue.SessionId
Response.Clear()
' set the http headers for the PDF response
HttpContext.Current.Response.ClearHeaders()
HttpContext.Current.Response.ClearContent()
HttpContext.Current.Response.ContentType = "text/html"
HttpContext.Current.Response.AppendHeader("Content-Disposition", _
"filename=""AddressLabels.HTM""")
' send the byte array containing the report as a binary response
HttpContext.Current.Response.BinaryWrite(rptIRIS)
HttpContext.Current.Response.End()
Catch ex As Exception
Finally
End TryYou won't be able to accomplish this with straight SOAP interfaces. You will
have to use a combination of Web service calls to list the reports in the
namespace and then a URL request to the server that includes the
parameterized URL for the report. You can certainly open it in a new browser
window under those conditions.
--
Bryan Keller
Developer Documentation
SQL Server Reporting Services
A friendly reminder that this posting is provided "AS IS" with no
warranties, and confers no rights.
"dw" <dw@.discussions.microsoft.com> wrote in message
news:08CC0691-B2A2-4F4C-A1DA-7DAB23E67F20@.microsoft.com...
> Hello...
> I am struggling with this...but I am getting close.
> I am trying to use the Web Service programming interface from my ASP.Net
> application. What I am trying to accomplish...is to allow the user to set
> some report parameters (date ranges, zip codes, etc). When the user
presses
> the Run button on my ASP.Net page, I would like to render the report in a
new
> browser window/page, and with the Toolbar so the user could export to
> whatever format that they want. Is this possible?
> Thanks for any help...
> - DW
> The code I am using now is the following..
> Dim rptIRIS As Byte() = Nothing
> Dim rsIRIS As Secure_SQLRS.ReportingService = New
> Secure_SQLRS.ReportingService
> rsIRIS.Credentials = New System.Net.NetworkCredential("ME", "Pwd",
> "Domain")
> rsIRIS.PreAuthenticate = True
> Dim rptPath As String = "/WebReports/UserLabels"
> Dim rptFormat As String = "HTML4.0"
> Dim rptViewerInfo As String = "<DeviceInfo>" & _
> "<Toolbar>true</Toolbar>" & _
> "<Parameters>false</Parameters>" & _
> "<DocMap>true</DocMap>" & _
> "<Zoom>100</Zoom>" & _
> "</DeviceInfo>"
>
> Dim rptParams(1) As Secure_SQLRS.ParameterValue
> Dim paramValue As Secure_SQLRS.ParameterValue = New
> Secure_SQLRS.ParameterValue
> paramValue.Name = "ProductID"
> paramValue.Value = "102"
> rptParams(0) = paramValue
> paramValue = New Secure_SQLRS.ParameterValue
> paramValue.Name = "ZipCode"
> paramValue.Value = "12345"
> rptParams(1) = paramValue
> Dim rptHistoryID As String = Nothing
> Dim credentials() As Secure_SQLRS.DataSourceCredentials = Nothing
> Dim showHideToggle As String = Nothing
> Dim encoding As String
> Dim mimeType As String
> Dim warnings() As Secure_SQLRS.Warning = Nothing
> Dim rptHistoryParams() As Secure_SQLRS.ParameterValue = Nothing
> Dim streamIDs() As String = Nothing
> Dim rptSessionHdr As Secure_SQLRS.SessionHeader = New
> Secure_SQLRS.SessionHeader
> rsIRIS.SessionHeaderValue = rptSessionHdr
> Try
> ' execute the report
> rptIRIS = rsIRIS.Render(rptPath, rptFormat, rptHistoryID,
> rptViewerInfo, rptParams, credentials, _
> showHideToggle, encoding, mimeType, rptHistoryParams,
> warnings, streamIDs)
> rptSessionHdr.SessionId = rsIRIS.SessionHeaderValue.SessionId
> Response.Clear()
> ' set the http headers for the PDF response
> HttpContext.Current.Response.ClearHeaders()
> HttpContext.Current.Response.ClearContent()
> HttpContext.Current.Response.ContentType = "text/html"
> HttpContext.Current.Response.AppendHeader("Content-Disposition", _
> "filename=""AddressLabels.HTM""")
> ' send the byte array containing the report as a binary response
> HttpContext.Current.Response.BinaryWrite(rptIRIS)
> HttpContext.Current.Response.End()
> Catch ex As Exception
> Finally
> End Try