I am having problems getting a call to ReportingService.render to work. I
keep getting this error:
System.Web.Services.Protocols.SoapException: The path of the item
'/ReportServer/report%20project1?%2fReport+Project1%2fReport1' is not
valid. The full path must be less than 260 characters long, must start
with slash; other restrictions apply. Check the documentation for
complete set of restrictions. -->
This comes from a url that worked in the browswer, which I then cut and
pasted into the code. Here is the rest of the code:
Dim rs As gscan.localhost.ReportingService _
= New localhost.ReportingService
Dim report As Byte() = Nothing
' Create an instance of the Reporting Services
' Web Reference.
' Create the credentials that will be used when accessing
' Reporting Services. This must be a logon that has rights
' to the Axelburg Invoice-Batch Number report.
' *** Replace "LoginName", "Password", and "Domain" with
' the appropriate values. ***
'rs.Credentials = New _
' System.Net.NetworkCredential("LoginName", _
' "Password", "Domain")
rs.Credentials = New _
System.Net.NetworkCredential("user.name", _
"password", "workgroup")
rs.PreAuthenticate = True
' The Reporting Services virtual path to the report.
Dim reportPath As String = _
"/ReportServer/report%20project1?%2fReport+Project1%2fReport1" 'path not valid
'http://localhost/Reportserver/report%20project1?%2fReport+Project1%2fReport1&rs:Command=Render 'works in the browser
' The rendering format for the report.
Dim format As String = "HTML4.0"
' The devInfo string tells the report viewer
' how to display with the report.
Dim devInfo As String = _
"<DeviceInfo>" + _
"<Toolbar>False</Toolbar>" + _
"<Parameters>False</Parameters>" + _
"<DocMap>True</DocMap>" + _
"<Zoom>100</Zoom>" + _
"</DeviceInfo>"
' Create an array of the values for the report parameters
' Dim parameters(1) As localhost.ParameterValue
Dim parameters() As localhost.ParameterValue = Nothing
Dim historyID As String = Nothing
Dim credentials() As localhost.DataSourceCredentials = Nothing
Dim showHideToggle As String = Nothing
Dim encoding As String
Dim mimeType As String
Dim warnings() As localhost.Warning = Nothing
Dim reportHistoryParameters() As _
localhost.ParameterValue = Nothing
Dim streamIDs() As String = Nothing
Dim sh As localhost.SessionHeader = _
New localhost.SessionHeader
rs.SessionHeaderValue = sh
Try
' Execute the report.
report = rs.Render(reportPath, format, historyID, _
devInfo, parameters, credentials, _
showHideToggle, encoding, mimeType, _
reportHistoryParameters, warnings, _
streamIDs)
sh.SessionId = rs.SessionHeaderValue.SessionId
' Flush any pending response.
Response.Clear()
' Set the HTTP headers for a PDF response.
HttpContext.Current.Response.ClearHeaders()
HttpContext.Current.Response.ClearContent()
HttpContext.Current.Response.ContentType = "text/html"
' filename is the default filename displayed
' if the user does a save as.
HttpContext.Current.Response.AppendHeader( _
"Content-Disposition", _
"filename=""Invoice-BatchNumber.HTM""")
' Send the byte array containing the report
' as a binary response.
HttpContext.Current.Response.BinaryWrite(report)
HttpContext.Current.Response.End()
Catch ex As Exception
If ex.Message <> "Thread was being aborted." Then
HttpContext.Current.Response.ClearHeaders()
HttpContext.Current.Response.ClearContent()
HttpContext.Current.Response.ContentType = "text/html"
HttpContext.Current.Response.Write( _
"&
Error" & _
ex.Message & "
")
HttpContext.Current.Response.End()
End If
End Try
End SubRemove the virtual directory name from the path.
string path = "/Report Project1/Reports/ReportName"
--
| Thread-Topic: reportingservice.render does not work - path not found?
| thread-index: AcWDATJ6XDR3wjtuT+iwdTWjP/QvDw==| X-WBNR-Posting-Host: 65.173.228.40
| From: "=?Utf-8?B?bmlja3B1cA==?=" <nickpup@.discussions.microsoft.com>
| Subject: reportingservice.render does not work - path not found?
| Date: Thu, 7 Jul 2005 07:36:01 -0700
| Lines: 99
| Message-ID: <345CE1C7-7BD5-4834-83BA-9148DE9338C0@.microsoft.com>
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="Utf-8"
| Content-Transfer-Encoding: 7bit
| X-Newsreader: Microsoft CDO for Windows 2000
| Content-Class: urn:content-classes:message
| Importance: normal
| Priority: normal
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
| Newsgroups: microsoft.public.sqlserver.reportingsvcs
| NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.2.250
| Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGXA02.phx.gbl!TK2MSFTNGXA03.phx.gbl
| Xref: TK2MSFTNGXA01.phx.gbl microsoft.public.sqlserver.reportingsvcs:47592
| X-Tomcat-NG: microsoft.public.sqlserver.reportingsvcs
|
| I am having problems getting a call to ReportingService.render to work.
I
| keep getting this error:
|
| System.Web.Services.Protocols.SoapException: The path of the item
| '/ReportServer/report%20project1?%2fReport+Project1%2fReport1' is not
| valid. The full path must be less than 260 characters long, must start
| with slash; other restrictions apply. Check the documentation for
| complete set of restrictions. -->
|
| This comes from a url that worked in the browswer, which I then cut and
| pasted into the code. Here is the rest of the code:
|
| Dim rs As gscan.localhost.ReportingService _
| = New localhost.ReportingService
|
| Dim report As Byte() = Nothing
| ' Create an instance of the Reporting Services
| ' Web Reference.
| ' Create the credentials that will be used when accessing
| ' Reporting Services. This must be a logon that has rights
| ' to the Axelburg Invoice-Batch Number report.
| ' *** Replace "LoginName", "Password", and "Domain" with
| ' the appropriate values. ***
| 'rs.Credentials = New _
| ' System.Net.NetworkCredential("LoginName", _
| ' "Password", "Domain")
| rs.Credentials = New _
| System.Net.NetworkCredential("user.name", _
| "password", "workgroup")
| rs.PreAuthenticate = True
| ' The Reporting Services virtual path to the report.
| Dim reportPath As String = _
|
| "/ReportServer/report%20project1?%2fReport+Project1%2fReport1" 'path not
valid
|
|
'http://localhost/Reportserver/report%20project1?%2fReport+Project1%2fReport
1&rs:Command=Render 'works in the browser
| ' The rendering format for the report.
| Dim format As String = "HTML4.0"
| ' The devInfo string tells the report viewer
| ' how to display with the report.
| Dim devInfo As String = _
| "<DeviceInfo>" + _
| "<Toolbar>False</Toolbar>" + _
| "<Parameters>False</Parameters>" + _
| "<DocMap>True</DocMap>" + _
| "<Zoom>100</Zoom>" + _
| "</DeviceInfo>"
| ' Create an array of the values for the report parameters
| ' Dim parameters(1) As localhost.ParameterValue
| Dim parameters() As localhost.ParameterValue = Nothing
| Dim historyID As String = Nothing
| Dim credentials() As localhost.DataSourceCredentials = Nothing
| Dim showHideToggle As String = Nothing
| Dim encoding As String
| Dim mimeType As String
| Dim warnings() As localhost.Warning = Nothing
| Dim reportHistoryParameters() As _
| localhost.ParameterValue = Nothing
| Dim streamIDs() As String = Nothing
| Dim sh As localhost.SessionHeader = _
| New localhost.SessionHeader
| rs.SessionHeaderValue = sh
| Try
| ' Execute the report.
| report = rs.Render(reportPath, format, historyID, _
| devInfo, parameters, credentials, _
| showHideToggle, encoding, mimeType, _
| reportHistoryParameters, warnings, _
| streamIDs)
| sh.SessionId = rs.SessionHeaderValue.SessionId
| ' Flush any pending response.
| Response.Clear()
| ' Set the HTTP headers for a PDF response.
| HttpContext.Current.Response.ClearHeaders()
| HttpContext.Current.Response.ClearContent()
| HttpContext.Current.Response.ContentType = "text/html"
| ' filename is the default filename displayed
| ' if the user does a save as.
| HttpContext.Current.Response.AppendHeader( _
| "Content-Disposition", _
| "filename=""Invoice-BatchNumber.HTM""")
| ' Send the byte array containing the report
| ' as a binary response.
| HttpContext.Current.Response.BinaryWrite(report)
| HttpContext.Current.Response.End()
| Catch ex As Exception
| If ex.Message <> "Thread was being aborted." Then
| HttpContext.Current.Response.ClearHeaders()
| HttpContext.Current.Response.ClearContent()
| HttpContext.Current.Response.ContentType = "text/html"
| HttpContext.Current.Response.Write( _
| "&
Error" & _
| ex.Message & "
")
| HttpContext.Current.Response.End()
| End If
| End Try
| End Sub
|
|
|
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment