Click here to Skip to main content
15,919,341 members
Home / Discussions / ASP.NET
   

ASP.NET

 
GeneralRe: a type can not be used as an expression Pin
Not Active20-Jun-07 9:09
mentorNot Active20-Jun-07 9:09 
GeneralRe: a type can not be used as an expression Pin
Christian Graus20-Jun-07 12:36
protectorChristian Graus20-Jun-07 12:36 
QuestionServer Error in '/' Application. Pin
Amr M. K.20-Jun-07 6:53
Amr M. K.20-Jun-07 6:53 
AnswerRe: Server Error in '/' Application. Pin
badgrs20-Jun-07 7:19
badgrs20-Jun-07 7:19 
QuestionCannot find Server or DNS Error Pin
BGadhia20-Jun-07 6:34
BGadhia20-Jun-07 6:34 
AnswerRe: Cannot find Server or DNS Error Pin
badgrs20-Jun-07 7:17
badgrs20-Jun-07 7:17 
GeneralRe: Cannot find Server or DNS Error Pin
BGadhia20-Jun-07 7:46
BGadhia20-Jun-07 7:46 
QuestionPlease Help with a Web Service! Pin
BigBlueEye20-Jun-07 6:08
BigBlueEye20-Jun-07 6:08 
I have code that calls a report (report service 2005) that I have to put into a web service and then stream to a client app (vb - asp.net). The code that runs the report, gets and displays the report fine if I place it on a regular aspx page but I can't figure out how to put it in a web service and stream it to a client for consumption.

The following code will display the report:
Response.ClearContent()
Response.AppendHeader("content-length", result.Length.ToString())
Response.ContentType = "application/PDF"
Response.BinaryWrite(result)
Response.Flush()
Response.Close()

and this will write it to a file:
Dim stream As System.IO.FileStream = System.IO.File.OpenWrite(fileName)
stream.Write(result, 0, result.Length)

But how to I do this as a web method?????

Full code is below:

---------------------------------------------------------------------------
Imports System.IO
Imports System.Web
Imports System.Net
Imports System.Web.Services
Imports System.Web.Services.Protocols

<webservice(namespace:="ggmitg.servicesbus")> _
<webservicebinding(conformsto:=wsiprofiles.basicprofile1_1)> _
<global.microsoft.visualbasic.compilerservices.designergenerated()> _
Public Class ServicesBus
Inherits System.Web.Services.WebService

<webmethod()> _
Public Function GetReport() As String
Dim rs As RptSrv2005.ReportingService2005
Dim rsExec As RptExec2005.ReportExecutionService

'create new proxy to the web service
rs = New RptSrv2005.ReportingService2005()
rsExec = New RptExec2005.ReportExecutionService()

'authenticate to the web service using windows credentials
rs.Credentials = System.Net.CredentialCache.DefaultCredentials
rsExec.Credentials = System.Net.CredentialCache.DefaultCredentials

'assign the url of the web service
rs.Url = "http://192.168.248.12/ReportServer/ReportService2005.asmx"
rsExec.Url = "http://192.168.248.12/ReportServer/ReportExecution2005.asmx"

'prepare render arguments
Dim result As Byte() = Nothing
'Dim reportPath As String = "/AP Recovery Audits Reports/VendorsStatus "
Dim format As String = "PDF"
Dim historyID As String = Nothing
Dim devInfo As String = "<deviceinfo><toolbar>False"
Dim extension As String = Nothing
Dim encoding As String = Nothing
Dim mimeType As String = Nothing
Dim warnings As RptExec2005.Warning() = Nothing
Dim streamIDs As String() = Nothing

'define variables needed for GetParameters() method
Dim reportName As String = "/AP Recovery Audits Reports/VendorsStatus"
Dim forRendering As Boolean = False
Dim values As RptSrv2005.ParameterValue() = Nothing
Dim credentials As RptSrv2005.DataSourceCredentials() = Nothing
Dim parameters As RptSrv2005.ReportParameter() = Nothing

'other parameters
'Dim fileName As String = "c:\testreport.pdf"
'Dim fileName As String = "c:\test.data" 'file to hold binary data

Try
'see if any parameters are needed
parameters = rs.GetReportParameters(reportName, historyID, forRendering, values, credentials)

'load selected report
Dim execInfo As New RptExec2005.ExecutionInfo
execInfo = rsExec.LoadReport(reportName, historyID)

'set the parameters needed for the report.
Dim params(0) As RptExec2005.ParameterValue ' = New RptExec2005.ParameterValue
params(0) = New RptExec2005.ParameterValue
params(0).Name = parameters(0).Name
params(0).Value = "140"

rsExec.SetExecutionParameters(params, "en-us")

result = rsExec.Render(format, devInfo, extension, encoding, mimeType, warnings, streamIDs)

'output the file
'Response.ClearContent()
'Response.AppendHeader("content-length", result.Length.ToString())
'Response.ContentType = "application/PDF"
'Response.BinaryWrite(result)
'Response.Flush()
'Response.Close()

'create a file stream and write the report to it
'Dim stream As System.IO.FileStream = System.IO.File.OpenWrite(fileName)
'stream.Write(result, 0, result.Length)

???????????????????
How do I stream output to a consumer app
???????????????????


Catch ex As Exception
'Response.Write(ex.Message)
End Try
'Return "Hello World"
End Function
End Class
QuestionCan't access functions Pin
MartyExodus20-Jun-07 5:30
MartyExodus20-Jun-07 5:30 
AnswerRe: Can't access functions Pin
Not Active20-Jun-07 6:05
mentorNot Active20-Jun-07 6:05 
NewsRe: Can't access functions Pin
MartyExodus20-Jun-07 6:27
MartyExodus20-Jun-07 6:27 
QuestionShift-Click: trap/prevent opening new browser - possible? Pin
Yab (Yet Another Bob)20-Jun-07 5:21
Yab (Yet Another Bob)20-Jun-07 5:21 
Questionabout popup window Pin
mredaghaly20-Jun-07 5:08
mredaghaly20-Jun-07 5:08 
QuestionPopup calendar Maser Page Pin
kjosh20-Jun-07 5:06
kjosh20-Jun-07 5:06 
QuestionHow do I make my DLL available on remote Server?? Pin
Cfer8320-Jun-07 5:05
Cfer8320-Jun-07 5:05 
AnswerRe: How do I make my DLL available on remote Server?? Pin
Cfer8320-Jun-07 5:57
Cfer8320-Jun-07 5:57 
GeneralRe: How do I make my DLL available on remote Server?? Pin
Cfer8320-Jun-07 7:39
Cfer8320-Jun-07 7:39 
GeneralRe: How do I make my DLL available on remote Server?? Pin
Not Active20-Jun-07 7:45
mentorNot Active20-Jun-07 7:45 
QuestionHow to Pin
alwinSCH20-Jun-07 4:52
alwinSCH20-Jun-07 4:52 
AnswerRe: How to Pin
ednrgc20-Jun-07 5:04
ednrgc20-Jun-07 5:04 
AnswerRe: How to Pin
badgrs20-Jun-07 5:04
badgrs20-Jun-07 5:04 
GeneralRe: How to Pin
alwinSCH20-Jun-07 5:06
alwinSCH20-Jun-07 5:06 
GeneralRe: How to Pin
badgrs20-Jun-07 5:14
badgrs20-Jun-07 5:14 
Questiondeployment in VB.net VS 2003??? Pin
Vimalsoft(Pty) Ltd20-Jun-07 4:21
professionalVimalsoft(Pty) Ltd20-Jun-07 4:21 
AnswerRe: deployment in VB.net VS 2003??? Pin
MartyExodus20-Jun-07 5:54
MartyExodus20-Jun-07 5:54 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.