Please Help with a Web Service!
-
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 _ _ _ Public Class ServicesBus Inherits System.Web.Services.WebService _ 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 = "False" Dim extension As String = Nothing Dim encoding As String = Nothing Dim mimeType As String = Nothing Dim warnings As RptExec2005.Warning() = Nothing