Page 1 of 1

Printing a Report via SOAP Web Service

Posted: Tue Sep 03, 2013 11:10 am
by kelgray
Hi

I am using Window Mobile 6.5 terminals to communicate to a SOAP Web Service.
There is a requirement to print a "report" from the Web Service which is activated from the terminal.

So I have a Web service method;
[SoapDocumentMethod(OneWay=true)]
[WebMethod]
public void _custPrint_Assay()
{
clsTest c = new clsTest();
c.WriteLOG("Recieved Call");

c.PrintRpt();
c.Dispose();
}

..And my Print Function is...
public void PrintRpt()
{
try
{
_res = WriteLOG("Starting Report");
// CREATE A NEW REPORT INSTANCE
StiReport rpt = new StiReport();
StiConfig.IsWeb = true;
// LOAD REPORT
rpt.Load("report.mrt");

rpt.Render(false);

// PRINT REPORT
Stimulsoft.Report.Print.StiPrinterSettings _settings = new Stimulsoft.Report.Print.StiPrinterSettings();
_settings.PrinterName = "Canon Generic PCL6 Driver";
_settings.Copies = 1;

_res = WriteLOG("Printing");
rpt.Print(false);
_res = WriteLOG("Finished");
}
catch (System.Threading.ThreadAbortException)
{
_res = WriteLOG("Thread Aborted");
}
catch (Exception ex)
{
_res = WriteLOG("PrintRpt() - " + ex.Message);
}
}

I get the Log down to "Printing", then I get a "Thread Aborted" exception when it tries to print??
I am using Version 2012.2 and the report is a very basic A4 page with just a logo in the Page header, haven't gone much farther!

Any help would be appreciated

Thanks
Andy

Re: Printing a Report via SOAP Web Service

Posted: Tue Sep 03, 2013 3:44 pm
by kelgray
Hi

My Bad, I didn't realise that writing a "Log" file to the bin folder of a Web service, causes the IIS application pool to stop!!! :oops:
(The wonders of google)

The report now works a treat

Apologies

Andy

Re: Printing a Report via SOAP Web Service

Posted: Wed Sep 04, 2013 5:27 am
by Andrew
Dear Andy,

I am happy you solved your issue yourself.

Have a nice day!
Thank you.