0

I'm trying to build a Windows desktop app to render reports located in SQL Server Reporting Services. I've been pulling my hair out because none of the examples I've found will compile. Here are the steps I followed:

  1. Opened Visual Studio and created a Windows desktop app using C# (WPF)

  2. Pasted in sample code from here (Microsoft).

  3. Created a service reference to http://localhost/reportserver/ReportExecution2005.asmx, the SSRS Web service that is supposed to provide the needed Render() method. I called it ReportExecution2005.

  4. Added a reference to System.Web.Services.

  5. Added Using statements for the Web service reference and the System.Web.Services.

So, I have these two added references and the Using statements shown below.

enter image description here

My problem is that ReportExecutionService does not exist. I can't find it anywhere. Can you tell me what I'm doing wrong? Thanks so much for your help!

enter image description here

Karl Hoaglund
  • 603
  • 10
  • 10
  • Are you runing SSRS locally on the same machine? Have you tested if you get a response from the web service by just navigating to the asmx in a browser? – Alan Schofield Dec 18 '17 at 19:02
  • Hi, @AlanSchofield. Thanks so much for your reply. I hadn't tried that but did just now. I tried the SSRS reporting service on both my local machine and on the eventual production machine. Both gave me a response. The response XML seems to contain the definition for a ReportExecutionSoap entity that had a "method" called Render (which gives me some hope). However, if I try to initialize an object of that type, I get an error that "cannot create an instance of the abstract class". – Karl Hoaglund Dec 19 '17 at 19:34

1 Answers1

3

Since you are accessing old ASMX service (classic asp service), you can try using Add Web Reference which you will find under the same dialog which you open via "Add Service Reference" and then click "Advanced" and Choose "Add Web Reference".

Once you do so, you should be able to compile your code without any issues. Make sure you remove existing reference to the service you have added via "Add Service Reference" to avoid any ambiguity in the client proxy code.

Having said this, you can still use "Add Service Reference" but with some modification to your sample code. But as of now the given solution should work for you. To know more about the difference, please have a look here:

Web Reference vs. Service Reference

Jay Nanavaty
  • 1,089
  • 1
  • 15
  • 29
  • Excellent answer, Jay! It solved the problem perfectly. When I first tried to add a reference, the option to add a web reference was dimmed out (in Visual Studio 2017). I can't remember why exactly. Your approach allows me to add a Web reference though a "back-door", and now everything compiles. Thanks! – Karl Hoaglund Dec 27 '17 at 18:41
  • Where exactly is this "advanced" in vs2017? I know exactly what you are talking about as I had to do this previously in vs2015 and a .net standard project. But in vs2017 with latest update and even the extension installed to add WCF Web Service References, I never see "advanced" in any dialog. – default_noob_network Dec 28 '17 at 22:18