Please am i doing something wrong, i debug the code no where it is giving me an error:
I am using the reportservice.asmx web service to render the report, but it is not displaying the report at all. it just shows me on IE saying Done with out any error, please can you tell me am i doing something wrong, after a very hard time i reached upto this point, on my form i just have a button on its click event i wrote the following code. and i have no other control on the form. except this code. just referencing the webservice.
thank you.
Dim rs As New ReportingService
Dim LogonCredentials As System.Net.NetworkCredential
Dim Items As CatalogItem
LogonCredentials = New System.Net.NetworkCredential("username", "password", "mydomainname")
rs.Credentials = LogonCredentials
'rs.Credentials = System.Net.CredentialCache.DefaultCredentials
rs.PreAuthenticate = True
' Render arguments
Dim result As Byte() = Nothing
Dim reportPath As String = "/PCSnetReports/StatusReport"
Dim format As String = "MHTML"
Dim historyID As String = Nothing
Dim devInfo As String = "<DeviceInfo><Toolbar>False</Toolbar></DeviceInfo>"
' Prepare report parameter.
Dim parameters(1) As ParameterValue
parameters(0) = New ParameterValue
parameters(0).Name = "eStatus"
parameters(0).Value = "All"
parameters(1) = New ParameterValue
parameters(1).Name = "UserName"
parameters(1).Value = "johnsmith" ' June
Dim credentials As DataSourceCredentials() = Nothing
Dim showHideToggle As String = Nothing
Dim encoding As String
Dim mimeType As String
Dim warnings As Warning() = Nothing
Dim reportHistoryParameters As ParameterValue() = Nothing
Dim streamIDs As String() = Nothing
Dim sh As New SessionHeader
rs.SessionHeaderValue = sh
Try
result = rs.Render(reportPath, format, historyID, devInfo, parameters, _
credentials, showHideToggle, encoding, mimeType, reportHistoryParameters, warnings, streamIDs)
sh.SessionId = rs.SessionHeaderValue.SessionId
Console.WriteLine("SessionID after call to Render: {0}", rs.SessionHeaderValue.SessionId)
Console.WriteLine("Execution date and time: {0}", rs.SessionHeaderValue.ExecutionDateTime)
Console.WriteLine("Is new execution: {0}", rs.SessionHeaderValue.IsNewExecution)
Catch e1 As SoapException
Console.WriteLine(e1.Detail.OuterXml)
End Try
' Write the contents of the report to an MHTML file.
Try
Dim stream As FileStream = File.Create("report.mhtml", result.Length)
Console.WriteLine("File created.")
stream.Write(result, 0, result.Length)
Console.WriteLine("Result written to the file.")
stream.Close()
Catch e2 As Exception
Console.WriteLine(e2.Message)
End Try
Hi,
You need to call the LoadReport method on the RS object before you call the Render method. For example:
rsExecService.ExecutionInfo execInfo = new rsExecService.ExecutionInfo();
rsExecService.ExecutionHeader execHeader = new rsExecService.ExecutionHeader();
rsExec.ExecutionHeaderValue = execHeader;
execInfo = rsExec.LoadReport(reportPath, historyID);
rsExec.SetExecutionParameters(execParameterValues, "en-gb");
String SessionId = rsExec.ExecutionHeaderValue.ExecutionID;
try
{
// Cache the results within the report definition.
report.Data = rsExec.Render(format, devInfo, out extension, out encoding, out mimeType, out warnings, out streamIDs);
}
catch (SoapException e)
{
Console.WriteLine(e.Detail.OuterXml);
}
Regards
Sanjay