Quantcast
Channel: SQL Server Reporting Services, Power View forum
Viewing all articles
Browse latest Browse all 10045

Response is not well formed XML - calling using C#

$
0
0

I am using an SSIS script task to call a SSRS report with 2 parameters,  and am getting the following error.  I cannot work out why, as I am calling a different report the exact same way from a different SSIS package.  The package is called from a 'master' SSIS package.  The thing is, if I right-click on the reporting package - it works fine and it generates the report.  But if it is called from the Master package then it fails with the error below.

What could be the cause of this?  The code is the exact same for both of the report SSIS packages.  

If I go to the report server, both reports have the same permissions as far as I can tell.  Any ideas whats wrong?  This is the line that falls over:

_parameters = rs.GetReportParameters(_reportName, _historyID, _forRendering, _values, _credentials); 

So its not even getting to the code to generate the reports, its trying to get the parameters?

System.InvalidOperationException: Response is not well-formed XML. ---> System.Xml.XmlException: Root element is missing.


            RS2005.ReportingService2005 rs;  
            RE2005.ReportExecutionService rsExec;  // Create a new proxy to the web service  
            rs = new RS2005.ReportingService2005();
            rsExec = new RE2005.ReportExecutionService();  // Authenticate to the Web service using Windows credentials  
            rs.Credentials = System.Net.CredentialCache.DefaultCredentials;  
            rsExec.Credentials = System.Net.CredentialCache.DefaultCredentials;
            rs.Url = reportServiceURL;
            rsExec.Url = reportServiceExecURL;
            string historyID = null; 
            string deviceInfo = null;  
            string format = "PDF";  
            Byte[] results;  
            string encoding = String.Empty;  
            string mimeType = String.Empty;  
            string extension = String.Empty;  
            RE2005.Warning[] warnings = null;  
            string[] streamIDs = null;  // Path of the Report - XLS, PDF etc. 

            

            string fileName = Path.Combine(localpath, reportName );  // Path and Name of the report - Please note this is not the RDL file. 
            string _reportName = ErrorReportPath;  
            string _historyID = null;  
            bool _forRendering = false;  
            RS2005.ParameterValue[] _values = null;  
            RS2005.DataSourceCredentials[] _credentials = null;  
            RS2005.ReportParameter[] _parameters = null;  
            
            try  
            {
                _parameters = rs.GetReportParameters(_reportName, _historyID, _forRendering, _values, _credentials);     
                RE2005.ExecutionInfo ei = rsExec.LoadReport(_reportName, historyID);     
                RE2005.ParameterValue[] parameters = new RE2005.ParameterValue[2];     
               if (_parameters.Length > 0)    
                {          
                    parameters[0] = new RE2005.ParameterValue();          
                    parameters[0].Label = "";          
                    parameters[0].Name  = "FileKey";
                    parameters[0].Value = FileKey.ToString();

                    parameters[1] = new RE2005.ParameterValue();
                    parameters[1].Label = "";
                    parameters[1].Name = "TPAName";
                    parameters[1].Value = TPAName.ToString();

            
                    
                }      
                
                rsExec.SetExecutionParameters(parameters, "en-us");      
                results = rsExec.Render(format, deviceInfo, out extension, out encoding, out mimeType, out warnings, out streamIDs);     
                using (FileStream stream = File.OpenWrite(fileName))      
                {          
                    stream.Write(results, 0, results.Length);     
                }  


Viewing all articles
Browse latest Browse all 10045

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>