Monday, February 20, 2012

RENDERSTREAM - What am I doing wrong?

I'm writing my own app that calls the RS Web Service.
So far, pretty good, but I can't seem to make RENDERSTREAM Work.
Do you have any idea what is wrong with this code?
The error I get is that RenderStream can not find the stream...
RenderedReport = myReportService.Render
(myReport, Format, HistoryID, DeviceInfo, myParameters, Credentials,
ShowHideToggle, Encoding, MimeType, UsedParameters, Warnings, StreamIDs)
For Each streamid As String In StreamIDs
RenderedStreams = myReportService.RenderStream _
(myReport, Format, streamid, Nothing, Nothing, Nothing,
Nothing, Nothing)
My DEVINFO for the RENDER is
DeviceInfo = "<DeviceInfo>"
DeviceInfo += "<HTMLFragment>True</HTMLFragment>"
DeviceInfo += "<Parameters>False</Parameters>"
DeviceInfo += "<Toolbar>False</Toolbar>"
DeviceInfo += "<StreamRoot>/" + Session("RSFolder") +
"/resources/</StreamRoot>"
DeviceInfo += "</DeviceInfo>"
Thanks.IraD wrote:
> I'm writing my own app that calls the RS Web Service.
> So far, pretty good, but I can't seem to make RENDERSTREAM Work.
> Do you have any idea what is wrong with this code?
> The error I get is that RenderStream can not find the stream...
Ira..
Try this:
Dim result As Byte() = Nothing
Dim image As Byte()
result = rs.Render(path, format, historyID, deviceInfo, parameters, Nothing,
Nothing, encoding, _
mimeType, parametersUsed, warnings, streamIds)
Select Case format
Case "HTML4.0", "HTML3.2"
' render stream for each image and save to disk
Dim stream As System.IO.FileStream
For Each streamid As String In streamIds
Dim encodingImage As String
Dim mimeTypeImage As String
image = rs.RenderStream(path, format, streamid, Nothing, Nothing,
parameters, encodingImage, mimeTypeImage)
stream = System.IO.File.OpenWrite(Server.MapPath("./Temp") & "\" &
streamid)
stream.Write(image, 0, CInt(image.Length))
stream.Close()
Next
Dim enc As System.Text.Encoding = System.Text.Encoding.UTF8
ReportPlaceholder.InnerHtml = enc.GetString(result)
Case Else
Response.ClearContent()
Response.AppendHeader("content-length", result.Length.ToString())
Response.ContentType = mimeType
Response.BinaryWrite(result)
Response.Flush()
Response.Close()
End Select|||Frank,
Much closer. My error was that I did not pass the "parameters" argument
correctly to RENDERSTREAM. I had NOTHING, now that I have sent along the
parameters, renderstream works.
But I don't understand the reportplaceholder.innerhtml statement. What I
now see on my screen is a box that looks like it wants to hold my chart - but
it doesn't have it. Do I have to send the results of renderstream to the
response object as well as the results of the render?
Thanks.
"Frank Matthiesen" wrote:
> IraD wrote:
> > I'm writing my own app that calls the RS Web Service.
> > So far, pretty good, but I can't seem to make RENDERSTREAM Work.
> >
> > Do you have any idea what is wrong with this code?
> > The error I get is that RenderStream can not find the stream...
> Ira..
> Try this:
> Dim result As Byte() = Nothing
> Dim image As Byte()
> result = rs.Render(path, format, historyID, deviceInfo, parameters, Nothing,
> Nothing, encoding, _
> mimeType, parametersUsed, warnings, streamIds)
>
> Select Case format
> Case "HTML4.0", "HTML3.2"
> ' render stream for each image and save to disk
> Dim stream As System.IO.FileStream
> For Each streamid As String In streamIds
> Dim encodingImage As String
> Dim mimeTypeImage As String
> image = rs.RenderStream(path, format, streamid, Nothing, Nothing,
> parameters, encodingImage, mimeTypeImage)
> stream = System.IO.File.OpenWrite(Server.MapPath("./Temp") & "\" &
> streamid)
> stream.Write(image, 0, CInt(image.Length))
> stream.Close()
> Next
> Dim enc As System.Text.Encoding = System.Text.Encoding.UTF8
> ReportPlaceholder.InnerHtml = enc.GetString(result)
> Case Else
> Response.ClearContent()
> Response.AppendHeader("content-length", result.Length.ToString())
> Response.ContentType = mimeType
> Response.BinaryWrite(result)
> Response.Flush()
> Response.Close()
> End Select
>
>|||IraD wrote:
> But I don't understand the reportplaceholder.innerhtml statement.
> What I
> now see on my screen is a box that looks like it wants to hold my
> chart - but it doesn't have it. Do I have to send the results of
> renderstream to the response object as well as the results of the
> render?
PlaceHolder is declared on aspx-page
Send me your mail-adress...i will send you the files with full code.
regards
Frank|||Much appreciated: IDOBROW@.AIB.ORG
"IraD" wrote:
> I'm writing my own app that calls the RS Web Service.
> So far, pretty good, but I can't seem to make RENDERSTREAM Work.
> Do you have any idea what is wrong with this code?
> The error I get is that RenderStream can not find the stream...
> RenderedReport = myReportService.Render
> (myReport, Format, HistoryID, DeviceInfo, myParameters, Credentials,
> ShowHideToggle, Encoding, MimeType, UsedParameters, Warnings, StreamIDs)
> For Each streamid As String In StreamIDs
> RenderedStreams = myReportService.RenderStream _
> (myReport, Format, streamid, Nothing, Nothing, Nothing,
> Nothing, Nothing)
> My DEVINFO for the RENDER is
> DeviceInfo = "<DeviceInfo>"
> DeviceInfo += "<HTMLFragment>True</HTMLFragment>"
> DeviceInfo += "<Parameters>False</Parameters>"
> DeviceInfo += "<Toolbar>False</Toolbar>"
> DeviceInfo += "<StreamRoot>/" + Session("RSFolder") +
> "/resources/</StreamRoot>"
> DeviceInfo += "</DeviceInfo>"
> Thanks.

No comments:

Post a Comment