How to print a SSRS report from a site connecting to AX through webservice?

Hi, I’m able to send a SSRS report directly to a printer (PDF printer for the example) thanks to the guide prepared by Martin Drab (http://dev.goshoom.net/en/2013/11/printing-reports-from-code-in-ax2012/) and it works great in AX 2012 using a job prepared with some modifications.

I got this code and added into a method into my webservice, then I call this method from my C# application to send the report directly to the printer, but it does nothing, no error, no nothing; I decided to do some testing at the AX side, where it works, so I created another job, and instead of putting the code directly into it, I instantiated the webservice method, and it did not work either, so I put the code in a class with the RunOn = OnClient, and it worked, since the webservice class MUST run in the SERVER, would that be the reason why is not running in the C# app as well?

I would appreciate if you could help me out to figure out what might be happening, if there’s something else you want me to explain, please let me know, thank you.

You really should use debugger, otherwise you’re just guessing. Begin with a breakpoint in Info.add() and if it doesn’t help, put it to SrsReportRunPrinter.printReport() and go deeper step by step.

The most likely explanation is that AOS service don’t have permissions on reporting server level or it can’t access the destination of print.

I tried to follow this guide:

http://learnax.blogspot.com/2012/03/ax-2012-how-to-debug-code-in-visual.html

But it’s never entering into the webservice method when it reaches the code line, am I missing something? I debugged it from AX, but, since it works there, it would be better to do it right from Visual Studio isn’t? thank you!

It’s not only better doing it from Visual Studio - it’s the only option! Services execute CIL code generated from X++, not X++ itself, therefore X++ debugger can’t help you. If you aren’t aware of this fact, you probably also haven’t generated CIL - do it now.

By the way, you don’t have to use the same account as AOS. Check out Debugging Services in AX 2012.

Hey Martin, I just found out something that might be useful, I did not start the development of this site, it has been designed to login always with the AOS user account, and, since the webservice runs on server,it sends the report to printers in the server account, which is the AOS one, if I run the same code from a client class, it works, but running it from a server class, it does not do anything, I woudl believe this is a permissions issue, could it be? thank you.

I mean, what I need is to send the report to a printer in the server, which does not work, however, If I run the same method from a “client” class, it does, but that’s because it’s using the client printers, I need to use the server ones, I think it’s related to permissions but I’m not sure, when the application starts, the credentials used are the same that are attached to the AOS, and this one as well is being used for the Application pool.

Yes, I already wrote that “The most likely explanation is that AOS service don’t have permissions on reporting server level or it can’t access the destination of print.”.