在ashx文件中使用SSRS呈现结果的异常 - 异常:SoapException - 输入XML格式不正确

时间:2014-07-01 22:13:12

标签: c# xml reporting-services wsdl

我正在尝试使用.WSDL通过SQL Server Reporting Services创建PDF报告。

我已按照这两篇文章中的说明进行操作:

http://blog.arvixe.com/creating-pdf-or-any-other-file-type-from-sql-reporting-services-using-wsdl-vs2012-part-2/

http://blog.arvixe.com/creating-pdf-or-any-other-file-type-from-sql-reporting-services-using-wsdl-vs2012-part-2/

我已经到了调用rs.Render的地方,但我收到以下异常: "输入XML格式不正确。一个或多个元素缺少结束标记或标记不匹配:根级别的数据无效。第1行,第1位。"

错误消息有意义,但我不确定它将引用什么XML。我一直在寻找解决方案,但我似乎找不到任何有这个特殊问题的人......这可能意味着我错过了一些非常简单的事情。

这是我设置所有内容的代码。我用X&替换了密码和服务器名称。最后一行是发生错误的地方。

ReportExecutionService rs = new ReportExecutionService();
            ExecutionInfo execInfo = new ExecutionInfo();
            ExecutionHeader execHeader = new ExecutionHeader();
            string historyId = null, encoding = "";
            string reportPath = "/wismusta/StudentHistory";
            string extension = "";
            string mimeType = "";
            string devInfo = "False";
            Warning[] warning = null;
            string[] streamId = null;
            byte[] result = null;

            rs.Url = "http://XXX.arvixe.com/ReportServer_SQL_Service/ReportExecution2005.asmx?wsdl";

            //add credentials
            rs.Credentials = new NetworkCredential("XXX", "XXX", "XXX.arvixe.com");

            //add parameters
            ParameterValue[] parameters = new ParameterValue[1];
            parameters[0] = new ParameterValue();
            parameters[0].Name = "auditionOrgId";
            parameters[0].Value = "1036";            

            rs.ExecutionHeaderValue = execHeader;
            execInfo = rs.LoadReport(reportPath, historyId);
            rs.SetExecutionParameters(parameters, "en-us");
            result = rs.Render("PDF", devInfo, out extension, out mimeType, out encoding, out warning, out streamId);

有没有人见过这个或有任何解决方案的想法?

谢谢!

1 个答案:

答案 0 :(得分:2)

我遇到了同样的问题,并通过将null传递给devInfo中的rs.Render()参数来解决此问题。