ReportExecutionService' does not contain a definition for 'GetReportDefinition'
i am trying this code .. having issue with GetReportDefinition() not found error..
i created the proxy class
wsdl.exe /language:CS /n:"ReportingService2006"
http://yourservername/reportserver/ReportService2005.asmx?wsdl
but the class doenot have method GetReportDefinition()
Error 1 'ReportingService2006.ReportExecutionService' does not contain a definition for 'GetReportDefinition'
usingSystem;
using System.Collections.Generic;
using
System.Text;
using
System.IO;
using
ReportingService2006;
using
System.Web.Services.Protocols;
namespace
SSRS_Report_defination
{
class
Program
{
static
void Main(string[]
args)
{
ReportExecutionService rs =
new
ReportExecutionService();
rs.Url =
"http://<Server Name>" +
"/_vti_bin/ReportServer/ReportService2006.asmx";
rs.Credentials = System.Net.
CredentialCache.DefaultCredentials;
string reportName =
"http://<Server Name>/Docs/Documents" +
"/AdventureWorks Sample Reports/Sales Order Detail.rdl";
byte[] reportDefinition =
null;
System.Xml.
XmlDocument doc =
new System.Xml.XmlDocument();
try
{
reportDefinition = rs.GetReportDefinition(reportName);
MemoryStream stream =
new
MemoryStream(reportDefinition);
string myDocumentsFolder =
Environment.GetFolderPath(Environment.SpecialFolder.Personal);
doc.Load(stream);
doc.Save(
Path.Combine(myDocumentsFolder,"Sales
Order Detail.rdl"));
}
catch (SoapException
e)
{
Console.WriteLine(e.Detail.InnerXml.ToString());
}
catch (IOException
e)
{
Console.WriteLine(e.Message);
}
}
}
}
May 19th, 2011 1:51pm
Hi,
You must reference the Reporting Services WSDL and import certain namespaces. For more information, see
Compiling and Running Code Examples. You can refer to below code example uses the
GetReportDefinition method to retrieve the definition of a report and store it as an XML document in the local file system:
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;
string reportName = "/SampleReports/Company Sales";
byte[] reportDefinition = null;
System.Xml.XmlDocument doc = new System.Xml.XmlDocument();
try
{
reportDefinition = rs.GetReportDefinition(reportName);
MemoryStream stream = new MemoryStream(reportDefinition);
doc.Load(stream);
doc.Save(@"C:\Company Sales.rdl");
}
catch (SoapException e)
{
Console.WriteLine(e.Detail.InnerXml.ToString());
}
catch (IOException e)
{
Console.WriteLine(e.Message);
}
}
}
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Free Windows Admin Tool Kit Click here and download it now
May 20th, 2011 2:10am