Hi!
I have a rdl file and would like to publish it programmatically? Is there any API or Web Service available for this.
Hello Vivekananda:
SQL Server 2005 Reporting Services (SSRS) provides a full-featured set of APIs that you can use to integrate Reporting Services with custom business applications and extend its functionality.
The Report Server Web service provides access to the full functionality of the report server.
A Report Server Web service is an Extensible Markup Language (XML) Web service with a Simple Object Access Protocol (SOAP) API. You can use the Web service to add the functionality of Reporting Services to your business applications.
For more information of the Report Server Web Service:
http://msdn2.microsoft.com/fr-fr/library/ms152787(SQL.90).aspx
ReportingService2005 Class contains the methods and properties that can be used to call the Microsoft SQL Server 2005 Reporting Services (SSRS) Web service.
You can use the method 'ReportingService2005.CreateReport' to create new report to the report server database.
Here is a code example for this:
Code Snippet
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());
}
}
}
Hope this helps.
For more information:
Report Server Web Service Features
Report Server Namespace Management Methods
Good luck.
No comments:
Post a Comment