views:

138

answers:

1

I am having difficulty getting images to display when I render a report. The text all renders fine, but the images appears as broken. How do I fix this?

My code:

ReportExecutionServiceSoapClient rs = new ReportExecutionServiceSoapClient();
        rs.ClientCredentials.Windows.AllowedImpersonationLevel =
            System.Security.Principal.TokenImpersonationLevel.Impersonation;


        byte[] result = null;
        string encoding, mimeType, extension, DeviceInfo = null;
        ReportExecution2005.Warning[] warnings = null;
        string[] streamIds = null;

        DeviceInfo = "<DeviceInfo><StreamRoot>/Temp/Images/</StreamRoot><HTMLFragment>True</HTMLFragment></DeviceInfo>";
        //ReportExecution2005.LogonUserResponse luResp = LogonUserE();

        //rs.LogonUser()

        try
        {
            string historyId = null;
            ExecutionInfo executionInfo;
            ExecutionHeader executionHeader;
            ServerInfoHeader serverInfoHeader;

            List<ParameterValue> parameterValues = new List<ParameterValue>();
            ParameterValue param1= new ParameterValue();
            param1.Name = "Id";
            param1.Value = "17";
            ParameterValue year = new ParameterValue();
            year.Name = "Year";
            year.Value = "2009";
            ParameterValue region = new ParameterValue();
            region.Name = "RegionId";
            region.Value = "0";

            parameterValues.Add(param1);
            parameterValues.Add(year);
            parameterValues.Add(region);

            serverInfoHeader = rs.LogonUser("user", "pass", null);


            executionHeader = rs.LoadReport(null, ReportPath, historyId, out serverInfoHeader,
                                            out executionInfo);

            rs.SetExecutionParameters(executionHeader, null, parameterValues.ToArray(), "en-us", out executionInfo);


            rs.Render(executionHeader, null, "HTML4.0", DeviceInfo, out result, out extension, out mimeType,
                      out encoding, out warnings, out streamIds);


            report.InnerHtml = System.Text.Encoding.ASCII.GetString(result);

        }

        catch (SoapException ex)
        {


        }
A: 

You'll need to call the RenderStream method using the streamIds that you get back from the Render method.

see the example at: http://ssrsphp.codeplex.com/

bhnat