Bullzip/pdfcreator pdf through webservice
Rushabh
Member Posts: 7
Hi, I am trying to generate pdf reports through bullzip printer written in codeunit, which I am trying to call from webservice. But it gives error of "Callback Functions are not allowed". I can run the codeunit in navision from other objects and report is printing in pdf ok, I can also use webservice to call other simple function of the same codeunit, which returns just string.
So I am very sure that it has some problem with the line of code Report.RunModal. Has anybody had any such experience or solution.
I also tried pdfcreator, but with that I am getting timeout error, with it also I am able to print ok through running codeunit in nav. In both cases, unfortunately I can't debug, as it is cross application.
Thanks,
Rushabh.
So I am very sure that it has some problem with the line of code Report.RunModal. Has anybody had any such experience or solution.
I also tried pdfcreator, but with that I am getting timeout error, with it also I am able to print ok through running codeunit in nav. In both cases, unfortunately I can't debug, as it is cross application.
Thanks,
Rushabh.
0
Comments
-
I'm curios why you are using bullzip or pdfcreator when you can simply use saveasPDF function on webservice in 2009?
http://blogs.msdn.com/nav-reporting/arc ... rvice.aspx0 -
Hi ara3n, thanks for your reply. The main reason, which I may be wrong is that the report is heavily formatted with lots of linings and formatting, so I am scepticle as to whether it will have same output as the original report and also, there is some coding in the section triggers, mainly for the hiding or showing the section.
Frankly, I am not much known of how to make customized report to get the pdf output, so I may be wrong, I will also see that further. One question, does making the report available on RTC and functionality such as saveaspdf, does it have any impact on the output of original report?
Thanks for your help.0 -
Hi Guys,
Does anybody have such issue, as per Rashad's suggestion, saveaspdf is possible, but why report.run doesn't work from webservice. Does it require any security setting or something like that. Because to enable saveaspdf I will require to design convert the customized reports into the role tailored layout. I prefer instead printing to pdf printers and displaying it. Is it possible to print report from webservice? Becaues I couldn't do it with either bullzip or pdfcreator, both gives error of 'soapexception:Callback functions are not allowed'(which I believe doesn't give any information as it is run across platform so debugger won't have any exact message).
In fact I can print the reports without problem directly by running codeunit function within nav, it doesn't work only through webservice.
Thanks in advance.0 -
My guess is that you do not have a layout for the report, in RTC if you don't have a layout, RTC will start the classic client and run the report. This was a workaround MS provided because upgrading all the report take a long time to upgrade.
I guess they didn't implement in webservice to call the classic client so they only option you have is to create the layout.0 -
Hi Rashed,
thanks for your reply, but actually I am just trying to use the codeunit in nav to print report to pdfprinter. So why should it require RTC layout for it. What I am trying to do is define function in the codeunit with printer of either bullzip or pdfcreator. Set the printer properties and report.runmodal or report.run.
And it looks like that is some issue with printing i.e. Report.runmodal or run statement. As if I comment that there is no error in initializing the automation controls or returning string. And as I said I can run and print this function from within another object(codeunit) in NAV alright.
I prefer to use pdfprinter instead of saveaspdf, as it will remove any efforts to define layout in rtc, which I am not known.
Any idea?
Thanks.0 -
The reason you need the layout is because the webservice needs to know how to render the report. It can't use the classic client.
Instead of printing your report, try to print a standard 2009 report, you probably won't get the error.
You have to learn how to create layout.0 -
OK, so that means when you hit report.runmodal through webservice it will try to print the RTC layout and not the classic report. Thanks Rashed.0
-
Hi Rashed,
Sorry to eat your time again, but I am getting error even with standard report. like 301. I can use saveaspdf but not report.runmodal, for your reference I am copying my codeunit and .net application(small windows application with just one button) code here.
Bullzip
IF ISCLEAR(BullZipPDF) THEN
CREATE(BullZipPDF);
FileDirectory := 'C:\NavRep\';
FileName := 'bullzip.pdf';
BullZipPDF.Init;
BullZipPDF.LoadSettings;
RunOnceFile := BullZipPDF.GetSettingsFileName(TRUE);
BullZipPDF.SetValue('Output',FileDirectory+FileName);
BullZipPDF.SetValue('Showsettings', 'never');
BullZipPDF.SetValue('ShowPDF', 'no');
BullZipPDF.SetValue('ShowProgress', 'no');
BullZipPDF.SetValue('ShowProgressFinished', 'no');
BullZipPDF.SetValue('SuppressErrors', 'yes');
BullZipPDF.SetValue('ConfirmOverwrite', 'no');
BullZipPDF.WriteSettings(TRUE);
REPORT.RUNMODAL(301,FALSE,FALSE);
TimeOut := 0;
WHILE EXISTS(RunOnceFile) AND (TimeOut < 10) DO BEGIN
SLEEP(1000);
TimeOut := TimeOut + 1;
END;
EXIT(FileDirectory + FileName);
pdfcreator----
IF ISCLEAR(PdfCreator) THEN
CREATE(PdfCreator);
IF ISCLEAR(PDFCreatorError) THEN
CREATE(PDFCreatorError);
FileDirectory := 'C:\';
FileName := 'example.pdf';
PDFCreatorError := PdfCreator.cError;
IF PdfCreator.cStart('/NoProcessingAtStartup',TRUE) = FALSE THEN
ERROR('Status: Error: ' + PDFCreatorError.Description);
PDFCreatorOption := PdfCreator.cOptions;
PDFCreatorOption.UseAutosave := 1;
PDFCreatorOption.UseAutosaveDirectory := 1;
PDFCreatorOption.AutosaveDirectory := FileDirectory;
PDFCreatorOption.AutosaveFormat := 0; //PDF file, you can also save in other formats
PDFCreatorOption.AutosaveFilename := FileName;
PdfCreator.cOptions := PDFCreatorOption;
PdfCreator.cClearCache();
DefaultPrinter := PdfCreator.cDefaultPrinter;
PdfCreator.cDefaultPrinter := 'PDFCreator';
PdfCreator.cPrinterStop := FALSE;
REPORT.RUNMODAL(301,FALSE,TRUE);
//REPORT.SAVEASPDF(301,FileDirectory+FileName);
//REPORT.SAVEASPDF(301,'C:\abc.pdf');
EXIT(FileDirectory+ FileName);
.net code----
BullzipS.BullZipPrint bz = new WindowsApplication1.BullzipS.BullZipPrint();
bz.UseDefaultCredentials = true;
bz.Url = "http://localhost:7047/DynamicsNAV/WS/CompanyName/Codeunit/BullZipPrint";
string bzstring = bz.PrintCustStatement();
MessageBox.Show(bzstring);
// The following is for pdfcreator
//AccessNAVReports rs = new AccessNAVReports();
//rs.UseDefaultCredentials = true;
//rs.Url = "http://localhost:7047/DynamicsNAV/WS/Companyname/Codeunit/AccessNAVReports";
//string reportpath = rs.PrintStatement();
//MessageBox.Show(reportpath);
And I can run the webservice and do anything except report.run.
thanks,
Rushabh.0 -
Hi All,
Did anyone ever get around the "Callback functions are not allowed" problem...???
Thanks.
I'm not crazy !!! Just ask my toaster...
.0 -
There is no work around.
SaveasPDF is the only solution.
you have to change your code to
if isservicetier then
report.safeasPDF
else
Report.runmodal
You can report it as a bug to MS or suggest it as a new feature.
They probably will answer it as by design.0 -
ara3n wrote:They probably will answer it as by design.
Ahhh yes... the good old catch-all....
I'm not crazy !!! Just ask my toaster...
.0 -
thetallbloke wrote:Hi All,
Did anyone ever get around the "Callback functions are not allowed" problem...???
Thanks
You can't use the UI when accessing from a webservice call.
Look here: http://msdn.microsoft.com/en-us/library/dd301080.aspx0 -
That makes sense... But in this case there is no UI to show... the report I want to run doesn't have any values to enter, I can run it from a codeunit with no forms being displayed, etc..
It would be nice if there were a variable to set to say "don't show any UI", kind of like :
IF GUIALLOWED THEN
SETNOGUITOSHOW;
or
IF ISSERVICETIER THEN
SETNOGUITOSHOW;.
I'm not crazy !!! Just ask my toaster...
.0 -
Oh, it's a report with no output pages?
I think the problem is that when NAV is running reports (just process or with page outputs), it runs GUI threads anyway, so thats why it fails. I guess margin calculations and dpis are involved and thats why the GUI comes in.
(Just a theory)0 -
You're probably right..
While there are no request pages or anything like that it still has to generate the output... the fact that I'm just trying to print the thing is probably neither here nor there....
I'm not crazy !!! Just ask my toaster...
.0 -
If there's no pages to output - just set Processing Only property of the report to Yes; -Works with NAV 2009 R2 for sure.
You can add a line to On Init just in case you have something in the request form:
CurrReport.USEREQUESTFORM(GUIALLOWED);
or
CurrReport.USEREQUESTFORM(ISSERVICETIER);0 -
Rushabh wrote:Hi, I am trying to generate pdf reports through bullzip printer written in codeunit, which I am trying to call from webservice. But it gives error of "Callback Functions are not allowed". I can run the codeunit in navision from other objects and report is printing in pdf ok, I can also use webservice to call other simple function of the same codeunit, which returns just string.
So I am very sure that it has some problem with the line of code Report.RunModal. Has anybody had any such experience or solution.
I also tried pdfcreator, but with that I am getting timeout error, with it also I am able to print ok through running codeunit in nav. In both cases, unfortunately I can't debug, as it is cross application.
Thanks,
Rushabh.
Have your WebService code spawn/enable a Job Queue job, that will then run the report. Since the Job Queue is running under a NAS, it isn't running the same "session" as your WebService, and thus doesn't have the "no callbacks" restriction. I use PDFCreator/Bullzip like this ALL the time with Reports fired off by Job Queue, and it works a treat!Experience is what you get, when you don't get what you want. --Anon.0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.7K Microsoft Dynamics NAV
- 18.8K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 328 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions
