Programmatically generating html report using ReportExecutionService class fails
Hello All,I am utilizing the ReportExecutionService class in MSRS 2008 to programmatically generate reports in a .NET Windows program. I have two Web References, one for ReportingService2005.asmx and one for ReportExecution2005.asmx. I am using ReportExecution2005 namespace to instantiate the ReportExecutionService object.The problem is that generating report content using the ReportExecutionService.Render method is not working consistently. It works a few times andthen throws a"Client found responsecontent type of '', when expected 'text/xml'. This is happening for reports that worked great on a prior test (same report name, same path, same parameters). Does anyone know if I need to change any settings in SSRS to correct this issue. Below is the codeReportExecutionService res = new ReportExecutionService();res.Timeout = System.Threading.Timeout.Infinite;res.Url = url.vvlu_char_vlu_cd.ToString(); res.Credentials = System.Net.CredentialCache.DefaultCredentials;// Render argumentsbyte[] result = null;string reportPath = @"../../../Stuff";ExecutionInfo ei = new ExecutionInfo();ExecutionHeader eh = new ExecutionHeader();res.ExecutionHeaderValue = eh; string format = "HTML4.0";string devInfo = @"<DeviceInfo><Toolbar>False</Toolbar></DeviceInfo>"; ReportExecution2005.DataSourceCredentials[] credentials = null;string showHideToggle = null;string encoding = "UTF-8";string mimeType="";string historyID = null;string extension = "html";ReportExecution2005.Warning[] warnings = null;ReportExecution2005.ParameterValue[] reportHistoryParameters = null;string[] streamIDs = null; // Prepare report parameter.ReportExecution2005.ParameterValue[2] paramters; parameters[0] = new ReportExecution2005.ParameterValue();parameters[0].Name = "charter_city";parameters[0].Value = null; parameters[1] = new ReportExecution2005.ParameterValue();parameters[1].Name = "state";parameters[1].Value = state; ei = res.LoadReport(reportPath, historyID);res.SetExecutionParameters(parameters, "en-us");this.Cursor = Cursors.WaitCursor;result = res.Render(format, devInfo, out extension, out mimeType, out encoding, out warnings, out streamIDs);//result...above works fine at first attempt. Given the same report, same parameters, on second attempt I get a "Client found responsecontent type of '', when expected 'text/xml'".Any help would be appreciated.Thanks much.
October 27th, 2009 10:22pm

Hi tchipkali, The code you have posted seems to be good. In this case, two possible causes are: 1. We get this error when the web service takes too long to respond 2. The URL of the web services is not the correct one. So, to solve the issue, please follow these steps: 1. Change the timeout to be a large one: res.Timeout = 300000; 2. Make sure the res.Url has the valid value at the second time. We can debug the windows application to check it. Please feel free to ask if you have any more questions. Thanks, Jin ChenJin Chen - MSFT
Free Windows Admin Tool Kit Click here and download it now
October 29th, 2009 4:39am

PDF to EPUB Converter , PDF to EPUB Converter for Mac , PDF File Transfer , Transfer PDF to iPhone 3G , PDF Ripper , Convert PDF to Image , Convert PDF to BMP , Convert PDF to Tiff , Convert PDF to Office , Convert PDF to Excel , Convert PDF to Word , Convert PDF to Doc , Convert PDF to TXT , Convert PDF to Text , Convert PDF to RTF , Convert PDF to Powerpoint
November 11th, 2010 3:43am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics