Groups | Blog | Home
all groups > sql server reporting services > june 2005 >

sql server reporting services : Using web services my images fail to display



jrlichina
6/30/2005 11:36:21 AM
My report has images embedded in the report and when I render the report it
shows everything but the images. Any ideas?

ReportingService rs = new ReportingService();
rs.Credentials = System.Net.CredentialCache.DefaultCredentials;

// Render arguments
byte[] ResultStream = null;
byte[] image = null;
string optionalString = null;
string reportPath = "/CIM/AuditReport";
string format = "HTML4.0";
string historyID = null;

string devInfo =
@"<DeviceInfo><Toolbar>False</Toolbar><HTMLFragment>True</HTMLFragment></DeviceInfo>";

// Prepare report parameter.
ParameterValue[] parameters = new ParameterValue[1];
parameters[0] = new ParameterValue();
parameters[0].Name = "inJobID";
parameters[0].Value = "19040";
DataSourceCredentials[] credentials = null;
string showHideToggle = null;
string encoding;
string mimeType;
Warning[] warnings = null;
ParameterValue[] reportHistoryParameters = null;
string[] streamIDs = null;
SessionHeader sh = new SessionHeader();
rs.SessionHeaderValue = sh;

try
{
ResultStream = rs.Render(reportPath, format, historyID, devInfo,
parameters, credentials, showHideToggle, out encoding, out mimeType, out
reportHistoryParameters, out warnings,out streamIDs);

// Write the report to Response
Response.BinaryWrite(ResultStream);
}
catch (Exception ex)
{
string sMsg;
sMsg = ex.Message;
}


AG
6/30/2005 12:35:04 PM
Ahhh the image dilema. You essentially need to call another page utilizing
some session state to get the images and stream back. You can see what I
mean by going to www.codeproject.com. There is a soap viewer implementation
that has what you need. Happy reporting. As a side note I have implemented
a fully soap enabled viewer to display reports via the web (so it can for
sure be done). No RS viewer!

[quoted text, click to view]
jrlichina
6/30/2005 12:46:03 PM
Actually I just saw that viewer code you mentioned. Currently I am using the
URL based method and in some instances the MS supplied viewer control. Both
methods work fine but now we are moving some stuff to an external web site so
we are trying to solve some security issues RS presents. One thing that was
mentioned was to use the web services so everything is done server side. We
are using a SSL accelerator and some other hardware. Hopefully the network
guys along with MS can figure out how to configure our network so that the
URL based calls to the reporting server can be secure and appear to be coming
from the external URL and not our internal SQL server. Thanks for the tip
and quick reply!



[quoted text, click to view]
Joseph Gordon
7/8/2005 1:36:02 PM
I'm having a similar issue trying to render a full report using web services.

I have created a RS report that allows client sorting. The report
"automatically" provides sorting images while viewing the report using the
report manager.

I am trying to retrieve this report via web services and output the HTML
within another IIS instance. The problem I am experiencing is that the
generated HTML contains references to the RS for the sorting images.

I have tried setting the <StreamRoot> deviceinfo tag, but no matter the
value I put in it, the HTML continues to try to download from the RS. Here
is my deviceInfo string:
<DeviceInfo><StreamRoot>/rsImages/</StreamRoot></DeviceInfo>

Setting this value alone shows no discernable difference in the rendered
report. The IMG SRC tags remain the same, and no values are populated in my
StreamIds OUTPUT parameter.

I have tried adding the <HTMLFragment> tag in the deviceinfo tag, but this
causes the report to not render the images at all (and hence lose the sorting
capability).

Any ideas? I can provide source code if needed.

Thanks.

[quoted text, click to view]
Joe
8/10/2005 12:16:05 PM
In your <streamroot> definition, put a more fully qualified url.

In my system I use Request.URL.ToString() to get the URL that was used to
invoke the page, then I trim off the first bit.

So, if page was invoked with http://localhost/... I grab off
http://localhost/ and then append the directory for my images.


AddThis Social Bookmark Button