Due to the requirements of my project I think I need to generate the RDL for
my reports programatically.
However, I think I also need to view them in the ReportViewer web control in
Remote processing mode. My question is, once my app has generated the RDL,
what's the best way of "getting it to SSRS" to that it can be processed.
In the following sequence, it is steps 3 & 4 that I am unsure about:
1. User requests report
2. App generates RDL based on user's config
3. App does something to give it to give the RDL to SSRS?
4. App sets ReportViewer.ServerReport.ReportPath to the path to the report
(what is the path?)
5. SSRS renders report and ReportViewer displays it to user.
I'd be grateful for any help
StuHello Stu,
You could use the Reporting Services Web Service to upload the report to
the report server.
Here is the sample code:
using System;
using System.IO;
using System.Web.Services.Protocols;
class Sample
{
public static void Main()
{
ReportingService2005 rs = new ReportingService2005();
rs.Credentials = System.Net.CredentialCache.DefaultCredentials;
Byte[] definition = null;
Warning[] warnings = null;
string name = "MyReport";
try
{
FileStream stream = File.OpenRead("MyReport.rdl");
definition = new Byte[stream.Length];
stream.Read(definition, 0, (int) stream.Length);
stream.Close();
}
catch(IOException e)
{
Console.WriteLine(e.Message);
}
try
{
warnings = rs.CreateReport(name, "/Samples", false, definition,
null);
if (warnings != null)
{
foreach (Warning warning in warnings)
{
Console.WriteLine(warning.Message);
}
}
else
Console.WriteLine("Report: {0} created successfully with no
warnings", name);
}
catch (SoapException e)
{
Console.WriteLine(e.Detail.InnerXml.ToString());
}
}
}
You could refer the following article for more information.
ReportingService2005.CreateReport Method
http://msdn2.microsoft.com/en-us/library/microsoft.wssux.reportingserviceswe
bservice.rsmanagementservice2005.reportingservice2005.createreport(SQL.90).a
spx
http://msdn2.microsoft.com/en-us/library/bb326462(SQL.90).aspx
Sincerely,
Wei Lu
Microsoft Online Community Support
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================This posting is provided "AS IS" with no warranties, and confers no rights.|||Hi ,
How is everything going? Please feel free to let me know if you need any
assistance.
Sincerely,
Wei Lu
Microsoft Online Community Support
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================This posting is provided "AS IS" with no warranties, and confers no rights.|||Wei,
I have this set-up and working. Are there any performance issues when
multiple users are uploading reports to the reportserver?
-marv
"Wei Lu [MSFT]" wrote:
> Hi ,
> How is everything going? Please feel free to let me know if you need any
> assistance.
> Sincerely,
> Wei Lu
> Microsoft Online Community Support
> ==================================================> When responding to posts, please "Reply to Group" via your newsreader so
> that others may learn and benefit from your issue.
> ==================================================> This posting is provided "AS IS" with no warranties, and confers no rights.
>|||hi lu
i am getting invalidoperation exception. any ideas?
XmlSerializer serializer = new XmlSerializer(typeof(String));
using (MemoryStream memorystream = new MemoryStream())
{
serializer.Serialize(memorystream, GenerateRDL());
ReportService = new ReportingService2005();
//ReportService.Credentials =System.Net.CredentialCache.DefaultCredentials;
ReportService.Credentials =System.Net.CredentialCache.DefaultNetworkCredentials;
ReportService.Url = reportserverurl;
memorystream.Position = 0;
Byte[] bytes = memorystream.GetBuffer();
try
{
BAR.RS2005.Warning[] warnings =ReportService.CreateReport("AdHocReport", "/ServerReports", true, bytes,
null);
//BAR.RS2005.Warning[] warnings =ReportService.SetReportDefinition(reportpath, bytes);
}
catch (InvalidOperationException ee)
{
StringBuilder error = new StringBuilder();
error.Append(ee.Message);
error.Append(ee.Source);
error.Append(ee.InnerException);
error.Append(ee.Data);
Trace.WriteLine(error.ToString());
}
}
"Wei Lu [MSFT]" wrote:
> Hello Stu,
> You could use the Reporting Services Web Service to upload the report to
> the report server.
> Here is the sample code:
> using System;
> using System.IO;
> using System.Web.Services.Protocols;
> class Sample
> {
> public static void Main()
> {
> ReportingService2005 rs = new ReportingService2005();
> rs.Credentials = System.Net.CredentialCache.DefaultCredentials;
> Byte[] definition = null;
> Warning[] warnings = null;
> string name = "MyReport";
> try
> {
> FileStream stream = File.OpenRead("MyReport.rdl");
> definition = new Byte[stream.Length];
> stream.Read(definition, 0, (int) stream.Length);
> stream.Close();
> }
> catch(IOException e)
> {
> Console.WriteLine(e.Message);
> }
> try
> {
> warnings = rs.CreateReport(name, "/Samples", false, definition,
> null);
> if (warnings != null)
> {
> foreach (Warning warning in warnings)
> {
> Console.WriteLine(warning.Message);
> }
> }
> else
> Console.WriteLine("Report: {0} created successfully with no
> warnings", name);
> }
> catch (SoapException e)
> {
> Console.WriteLine(e.Detail.InnerXml.ToString());
> }
> }
> }
> You could refer the following article for more information.
> ReportingService2005.CreateReport Method
> http://msdn2.microsoft.com/en-us/library/microsoft.wssux.reportingserviceswe
> bservice.rsmanagementservice2005.reportingservice2005.createreport(SQL.90).a
> spx
> http://msdn2.microsoft.com/en-us/library/bb326462(SQL.90).aspx
> Sincerely,
> Wei Lu
> Microsoft Online Community Support
> ==================================================> When responding to posts, please "Reply to Group" via your newsreader so
> that others may learn and benefit from your issue.
> ==================================================> This posting is provided "AS IS" with no warranties, and confers no rights.
>
No comments:
Post a Comment