Hi,
I set up a Telerik Reporting WCF Service, a silverlight client to show the report, created a report, succesfully added the WCF report service reference to the client, and verified that it is called. Everything works up to that part.
But how do I implement the methods of the IReportService interface? I can't find examples of what I'm supposed to do. Below is the code that I guessed so far from trial and error, but this gives a xaml error.
Is there an example of how to implement a WCF reporting service?
In specific the method: GetPage, what is the byte[]?The manual says "Gets or sets the Byte array that contains the current report page.", but is that in pdf format?
Regards,
Bayram
I set up a Telerik Reporting WCF Service, a silverlight client to show the report, created a report, succesfully added the WCF report service reference to the client, and verified that it is called. Everything works up to that part.
But how do I implement the methods of the IReportService interface? I can't find examples of what I'm supposed to do. Below is the code that I guessed so far from trial and error, but this gives a xaml error.
Is there an example of how to implement a WCF reporting service?
In specific the method: GetPage, what is the byte[]?The manual says "Gets or sets the Byte array that contains the current report page.", but is that in pdf format?
Regards,
Bayram
// NOTE: You can use the "Rename" command on the "Refactor" menu to change the class name "ReportService" in code, svc and config file together. [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)] public class ReportService : IReportService { public void DoWork() { } private byte[] RenderToArray(string instanceID) { Telerik.Reporting.Processing.ReportProcessor reportProcessor = new Telerik.Reporting.Processing.ReportProcessor(); //set any deviceInfo settings if necessary System.Collections.Hashtable deviceInfo = new System.Collections.Hashtable(); Telerik.Reporting.InstanceReportSource instanceReportSource = new Telerik.Reporting.InstanceReportSource(); instanceReportSource.ReportDocument = new PowerBrowser.Web.Modules.Reporting.ReportZakenDashboard(); Telerik.Reporting.Processing.RenderingResult renderingResult = reportProcessor.RenderReport("PDF", instanceReportSource, deviceInfo); string fileName = renderingResult.DocumentName + "." + renderingResult.Extension; string path = System.IO.Path.GetTempPath(); string filePath = System.IO.Path.Combine(path, fileName); byte[] result = new byte[renderingResult.DocumentBytes.Length]; using (System.IO.MemoryStream fs = new System.IO.MemoryStream(result)) { fs.Write(renderingResult.DocumentBytes, 0, renderingResult.DocumentBytes.Length); } return result; } public Telerik.Reporting.Service.PageInfo GetPage(string instanceID, int pageNumber) { PageInfo info = new PageInfo() { Buffer = RenderToArray(""), PageNumber = 1 }; return info; } public List<Parameter> GetReportParameters(string report, NameValueDictionary deviceInfo, NameValueDictionary parameters) { List<Parameter> reportParameters = new List<Parameter>(); return reportParameters; } public IList<ReportInfo> ListAvailableReports() { ReportInfo info = new ReportInfo() { Description = "Mijn zaken", FullName = "Rapport - Mijn zaken", Name = "ReportZakenDashboard" }; List<ReportInfo> reports = new List<ReportInfo>(); reports.Add(info); return reports; } public IList<ExtensionInfo> ListRenderingExtensions() { List<ExtensionInfo> extensions = new List<ExtensionInfo>(); ExtensionInfo info = new ExtensionInfo() { LocalizedName = "PDF", Name = "PDF" }; extensions.Add(info); return extensions; } public RenderingResult Render(string format, string report, NameValueDictionary deviceInfo, NameValueDictionary parameters) { RenderingResult renderingResult = null; if (report == "ReportZakenDashboard") { renderingResult = new RenderingResult() { DocumentBytes = new byte[] { }, DocumentName = "Test", Extension = "PDF", }; } return renderingResult; } public RenderingSessionInfo RenderAndCache(string format, string report, NameValueDictionary deviceInfo, NameValueDictionary parameters) { RenderingSessionInfo info = new RenderingSessionInfo() { PageCount = 1, DocumentName = "Mijn zaken", PageNumber = 1, Report = "ReportZakenDashboard" }; return info; } }