GetReportDefinition - are you missing a using directive or an assembly reference
I'm getting "are you missing a using directive or an assembly reference" on GetReportDefinition. What am I missing? I'm using SQL Server 2008.
http://msdn.microsoft.com/en-us/library/aa258101(v=SQL.80).aspx
March 21st, 2011 10:58am
You need the following
Imports System
Imports System.IO
Imports System.Web.Services.Protocols
to use getreportdefinitonRegards
Partha Mandayam
IT Consultant
Invacare
http://weblogs.asp.net/pmandayam
http://partha.tripod.com
Free Windows Admin Tool Kit Click here and download it now
March 21st, 2011 1:32pm
I added the namespace but I'm still getting the same error. ???
March 21st, 2011 2:21pm
Does your code follow this sample?
http://msdn.microsoft.com/en-us/library/aa258101(SQL.80).aspxRegards
Partha Mandayam
IT Consultant
Invacare
http://weblogs.asp.net/pmandayam
http://partha.tripod.com
Free Windows Admin Tool Kit Click here and download it now
March 21st, 2011 2:38pm
yes I think that's the same as
http://msdn.microsoft.com/en-us/library/aa258101(v=SQL.80).aspx
Am I suppose to write my own GetReportDefinition method?
March 21st, 2011 2:46pm
No. GetReportdefinition is a method of the Reportingservice class.
Can you post your code and the line which gives error?Regards
Partha Mandayam
IT Consultant
Invacare
http://weblogs.asp.net/pmandayam
http://partha.tripod.com
Free Windows Admin Tool Kit Click here and download it now
March 21st, 2011 3:23pm
protected
void Page_Load(object
sender, EventArgs e)
{
//ReportingUI.ReportingService rs = new ReportingUI.ReportingService();
ReportingUI.ReportingService.ReportExecutionService rs =
new ReportingUI.ReportingService.ReportExecutionService();
rs.Url = "http://MyServerName/ReportServer/ReportExecution2005.asmx?wsdl";
rs.Credentials = System.Net.CredentialCache.DefaultCredentials;
string reportName =
"C:/blah/blah/Test.rdl";
byte[] reportDefinition =
null;
System.Xml.XmlDocument doc =
new System.Xml.XmlDocument();
try
{
reportDefinition = rs.GetReportDefinition(reportName);
MemoryStream stream =
new
MemoryStream(reportDefinition);
}
}
Error 'ReportingUI.ReportingService' is a 'namespace' but is used like a 'type'
on line
ReportingUI.ReportingService rs = new ReportingUI.ReportingService();
Error 'ReportingUI.ReportingService.ReportExecutionService' does not contain a definition for
'GetReportDefinition' and no extension method 'GetReportDefinition' accepting a first argument of type 'ReportingUI.ReportingService.ReportExecutionService' could be found (are you missing a using directive or an assembly reference?)
on line
reportDefinition = rs.GetReportDefinition(reportName);
BTW: This is a separate project from the project in BIDS.
March 21st, 2011 3:41pm
This does not look like the code sample
Where is the line
ReportingService rs = new ReportingService();
in your codeRegards
Partha Mandayam
IT Consultant
Invacare
http://weblogs.asp.net/pmandayam
http://partha.tripod.com
Free Windows Admin Tool Kit Click here and download it now
March 21st, 2011 4:41pm
I'm getting the error
'ReportingUI.ReportingService' is a 'namespace' but is used like a 'type'
when I tried
ReportingService rs = new ReportingService();
I'm using the following instead
ReportingUI.ReportingService.ReportExecutionService rs =
new ReportingUI.ReportingService.ReportExecutionService();
March 21st, 2011 5:08pm
That's the problem.
You cannot use 'ReportingUI.ReportingService' like that because it is a namespace.
Try to follow the sample
Regards
Partha Mandayam
IT Consultant
Invacare
http://weblogs.asp.net/pmandayam
http://partha.tripod.com
Free Windows Admin Tool Kit Click here and download it now
March 21st, 2011 5:31pm
I tried this line of code: ReportingService rs = new ReportingService();
This is the error: ReportingUI.ReportingService.ReportExecutionService rs =
new ReportingUI.ReportingService.ReportExecutionService();
What sample did you want me to try?
March 21st, 2011 5:34pm
Make your code as per this sample
http://msdn.microsoft.com/en-us/library/aa258101(SQL.80).aspxRegards
Partha Mandayam
IT Consultant
Invacare
http://weblogs.asp.net/pmandayam
http://partha.tripod.com
Free Windows Admin Tool Kit Click here and download it now
March 22nd, 2011 10:15am
Hi n3wb13,
It seems that the ReportingService and getreportdefiniton definitions are missing in your project. Please refer to following steps to add a definition
file in your project.
1. Type command: cd C:\Program Files\Microsoft SDKs\Windows\v6.0A\bin in Command Prompt pop-up.
Note: if you don’t install reporting service by default, please find the path where wsdl.exe exists.
2. Run the command: wsdl.exe /language:CS /n:"Test.ReportingServices"
http://yourservername/reportserver/ReportService2005.asmx?wsdl in Command Prompt pop-up, it could
generate a definition file which name is ReportingService2005.cs, this file has getreportdefiniton function and ReportingService function.
Note: Test.ReportingServices is a namespace name in the definition file, and you could replace it by yourself.
3. Copy Test.ReportingServices namespace from ReportingService2005.cs file under C:\Program Files\Microsoft SDKs\Windows\v6.0A\bin to your project.
Please refer to code A. The code works fine on my machine.
Code A: save report in the local file system:
using System;
using System.IO;
using System.Web.Services.Protocols;
using Test.ReportingServices;
public
partial
class _Default : System.Web.UI.Page
{
protected
void Page_Load(object sender,
EventArgs e)
{
ReportingService2005 rs =
new ReportingService2005();
string reportName =
"/Sales/Report2";
byte[] reportDefinition =
null;
System.Xml.XmlDocument doc =
new System.Xml.XmlDocument();
rs.Credentials = System.Net.CredentialCache.DefaultCredentials;
reportDefinition = rs.GetReportDefinition(reportName);
MemoryStream stream =
new MemoryStream(reportDefinition);
doc.Load(stream);
doc.Save(@"C:\tSalesRpt2.rdl");
}
}
namespace Test.ReportingServices
{
Please copy Test.ReportingServices code in to it from ReportingService2005.cs file.
}
If you have any question, plese feel free to ask.
Thanks,
Eileen Zhao
March 25th, 2011 8:16am
Hi Eileen,
Is there a corresponding file for SSRS 2008?Regards
Partha Mandayam
IT Consultant
Invacare
http://weblogs.asp.net/pmandayam
http://partha.tripod.com
Free Windows Admin Tool Kit Click here and download it now
March 25th, 2011 5:59pm
Hi mcp111,
I am sorry for not making my post clear enough. The file ReportingService2005.cs mentioned in my previous post Step 2 is for managing SSRS 2008 only.
For SSRS 2008 R2, we have ReportingService2010.cs which can be generated automatically by running following command on SSRS 2008 R2 server,
wsdl.exe /language:CS /n:"Test.ReportingServices"
http://yourservername/reportserver/ReportService2010.asmx?wsdl
Detailed information can be found below,
SQL Server 2008 R2:
Report Server Web Service Endpoints
http://msdn.microsoft.com/en-us/library/ms155398.aspx
SQL Server 2008: Report Server Web Service
Endpoints
http://msdn.microsoft.com/en-us/library/ms155398(v=SQL.100).aspx
Let me know if anything needs further clarification.
Thanks,
Eileen Zhao
March 29th, 2011 6:18am
Hi Eileen,
i created the file after compiling geting the follwoing error
Error 1 'Microsoft.Reporting.WebForms.Internal.Soap.ReportingServices2005.Execution.ReportExecutionService' does not contain a definition for
'GetReportDefinition' and no extension method 'GetReportDefinition' accepting a first argument of type 'Microsoft.Reporting.WebForms.Internal.Soap.ReportingServices2005.Execution.ReportExecutionService'
could be found (are you missing a using directive or an assembly reference?)
Free Windows Admin Tool Kit Click here and download it now
May 19th, 2011 1:03pm
Hello,
It appears as though the GetReportDefinition method is missing from the ReportService2010 Namespace. Is there a new method to replace it?
Thanks,
Ben Lezin
May 26th, 2011 6:51pm