Skip to main content
 首页 » 编程设计

c#之尝试调用 Reporting Services Web 方法时出现 NotImplementedException

2024年01月11日39zhujiabin

我正在尝试从另一个 C# 函数调用 ReportingServices2005.asmx Web 服务的 GetReportParameters 方法,但出现以下错误:

System.NotImplementedException: The method or operation is not implemented. 

我只是从微软的网站上复制代码:

Get Parameters Example

这是这段代码:

            bool forRendering = false; 
            string historyID = null; 
            ParameterValue[] values = null; 
            DataSourceCredentials[] credentials = null; 
            ReportParameter[] parameters = null; 
 
            try 
            { 
                parameters = rs.GetReportParameters(reportName,historyID, forRendering, values,credentials); 
 
                if (parameters != null) 
                { 
                    foreach (ReportParameter rp in parameters) 
                    { 
                        Console.WriteLine("Name: {0}", rp.Name); 
                    } 
                } 
            } 
 
            catch (SoapException e) 
            { 
                error = e.Detail.InnerXml.ToString(); 
            } 

其中 reportName 是一个包含报告名称的字符串。

有什么想法吗?

提前致谢!

编辑

这是完整的堆栈跟踪:

System.NotImplementedException: The method or operation is not implemented. 
at Foo.Foo.ReportingService2005.GetReportParameters(String reportName, String historyID, Boolean forRendering, ParameterValue[] values, DataSourceCredentials[] credentials) in C:\Visual Studio Projects\Foo\Foo\Web References\Foo\Reference.cs:line 4112 
at Foo.Foo.GetReportParameters(String username, String password, String reportName) in C:\Visual Studio Projects\Foo\Foo\Foo.asmx.cs:line 265 

请您参考如下方法:

我删除并重新添加了 Web Reference,但这并没有起到作用,但经过大量试验和错误后,我注意到了这一点

ParameterValue[] values = null; 
DataSourceCredentials[] credentials = null; 
ReportParameter[] parameters = null; 

我们都在引用另一个 Web 引用......甚至不确定这怎么可能......但是,我删除了另一个与 Reporting Services 无关的 Web 引用,现在一切正常。