The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

tgauchet (1) [Avatar] Offline
#1
I have try to use RS2005 SOAP API to render a report.
Sample Listing 10.4 is totally wrong.I don't understand how you can publish so much errors...

Here is the right code:
private static void RunByWS()
{

ReportExecutionService rse = RsHelpers.RseProxy;
byte[] result = null;
string reportPath = "/xxxxxxxxx/yyyyyyyyyyyyyy";
string historyID = null;
string format = "PDF";
string devInfo = null;

string encoding;
string mimeType;
string extension;
string[] streamIDs = null;


Warning[] warnings = null;
ParameterValue[] parameters = null;

//start
ExecutionInfo execInfo = new ExecutionInfo();
ExecutionHeader execHeader = new ExecutionHeader();
rse.ExecutionHeaderValue = execHeader;
execInfo = rse.LoadReport(reportPath, historyID);

String SessionId = rse.ExecutionHeaderValue.ExecutionID;

//param
parameters = new ParameterValue[1];
parameters[0] = new ParameterValue();
parameters[0].Name = "thhhhhhhhhhhh";
parameters[0].Value = "ffffffff;
rse.SetExecutionParameters(parameters, "fr-fr");

result = rse.Render(format, devInfo, out extension, out mimeType, out encoding, out warnings, out streamIDs); ;

string FileName = String.Format("{0}.{1}","d:\temp\abbhhyu",extension);
FileStream stream = File.Create(FileName, result.Length);
stream.Write(result, 0, result.Length);
stream.Close();
Process.Start(FileName);

}
.

namespace ConsoleApplication11
{

internal enum PermissionType
{
Item,
System
}
/// <summary>
/// Some Reporting Services helper methods
/// </summary>
internal class RsHelpers
{

AND

static RsHelpers()
{

}
internal static ReportExecutionService RseProxy
{
get
{
ReportExecutionService rsProxy = new ReportExecutionService();
rsProxy.Credentials = System.Net.CredentialCache.DefaultCredentials;
rsProxy.Url = "http://vbbdbfdbfdsbs/ReportServer/ReportExecution2005.asmx";

return rsProxy;
}
}


bye

Message was edited by:
tgauchet