WCF webservice OR .net webservice

Posted on 2012-09-19
Last Modified: 2012-09-26
I have  created a .net website which calls SSRS web service with a report name, and parameter, generates the report as a pdf document and saves it on a file server. This part is just for learning to use SSRS webservice to generate reports.

I now want to create my Reporting Web Service that will take an rdl file name and the parameter values to to run the report on  a predefined report server to generate the report in pdf format and return byte array for the file to the client.

Example: I have a report called CustomersByRegion on my report server that takes regionID as a parameter. The report shows all the customers in that region.

Now using my Reporting web service I want to be able to pass the rdl name 'CustomersByRegion' and RegionID 101, so this web service will use the SSRS web service to run the report with this parameter, generate a byte array for a pdf and return the byte array.

Is this possible? Do I need to create a WCF web service for this purpose or just a .net web service?

Question by:patd1
    LVL 18

    Assisted Solution


    Yes this is possible to do and you should use WCF.

    You need to create a service contract that returns a byte array or Stream and then call your method to create the pdf from SSRS and then simply return the byte array.

    Have a review of this for Stream

    and this for byte[]...



    Accepted Solution

    I added byte[] GenerateSSRSReport(string memberID) operation to my wcf service

    I also added service reference (as I did not see an option to add web reference) to myserver/ReportExecution2005.asmx?WSDL and /ReportService2005.asmx?WSDL

    Now when I bring CreateReport code from my web application where it was working fine, I get several compilation errors in this method. I have marked these in the code. Please guide on how to resolve.  Thank You.

    namespace MyReportService
        public class MyFaultException
            private string _reason;
            public string Reason
                get { return _reason; }
                set { _reason = value; }
        class DSCC_ReportService : IDSCC_ReportService
            #region IMyReportService Members
            public byte[] GenerateSSRSReport(string memberID)
                byte[] ReportLetter = CreateReport(memberID);
                return ReportLetter;
    public static byte[] CreateReport(string member)
                string memberID = member;
                //RS2005.ReportingService2005 rs;  //compilation error in these 4 lines, so changed it to the code that follows  after these 4 lines commented out.
                //RE2005.ReportExecutionService rsExec;
                //rs = new RS2005.ReportingService2005();
                //rsExec = new RE2005.ReportExecutionService();
      RS2005.ReportingService2005SoapClient rs;
                RE2005.ReportExecutionServiceSoapClient rsExec;
                rs = new RS2005.ReportingService2005SoapClient();
                rsExec = new RE2005.ReportExecutionServiceSoapClient();            
                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;
                string reportName = @"/Data Mgmt/Sample HAP Letter";
                string historyID = null;
                bool forRendering = false;
                RS2005.ParameterValue[] _values = null;
                RS2005.DataSourceCredentials[] _credentials = null;
                RS2005.ReportParameter[] _parameters = null;
               _parameters = rs.GetReportParameters(reportName, historyID, forRendering, _values, _credentials);  /compilation error here, not sure what to do. please guide.
                    RE2005.ExecutionInfo ei = rsExec.LoadReport(reportName, historyID); //compilation errors
                    RE2005.ParameterValue[] parameters = new RE2005.ParameterValue[1];
                    if (_parameters.Length > 0)
                        parameters[0] = new RE2005.ParameterValue();
                        parameters[0].Label = "MemberID";
                        parameters[0].Name = "MemberID";
                        parameters[0].Value = memberID; 
                    rsExec.SetExecutionParameters(parameters, "en-us"); //compilation error
                    results = rsExec.Render(format, deviceInfo,
                              out extension, out encoding,
                              out mimeType, out warnings, out streamIDs);
                    return results;     

    Open in new window


    Author Closing Comment

    Problem solved. Found the advanced tab on add serveic reference diaglogue, where I can add web refefrenc and the whole thing works.

    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    Join & Write a Comment

    IP addresses can be stored in a database in any of several ways.  These ways may vary based on the volume of the data.  I was dealing with quite a large amount of data for user authentication purpose, and needed a way to minimize the storage.   …
    Flash ( has evolved over the years to where it has become a masterful tool for displaying content screen.  It has excellent layout placement, UI precision as well as rendering capabilities. This, along with t…
    Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
    In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor ( If you're interested in additional methods for monitoring bandwidt…

    732 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    17 Experts available now in Live!

    Get 1:1 Help Now