Hello,
I have a codeunit with a function that unzip some datas.
I use a .NET dll of my own based on SharpZLib to do that :
PROCEDURE UnzipInputXml@1000000006(inputXml@1000000005 : BigText;VAR outputXml@1000000002 : BigText);
VAR
zipLib@1000000000 : DotNet "'ZipLib, Version=1.0.0.0, Culture=neutral, PublicKeyToken=f578592a428333cd'.ZipLib.Zip" RUNONCLIENT;
BEGIN
outputXml.ADDTEXT(zipLib.UnzipToStream(inputXml));
END;
When i use this function in RTC, all is working fine.
But I need to do this each night and as I'm using some .net code i can't do it with the standard job queue.
So my idea was to use dynamics web service.
But now i have this error : Callback functions are not allowed.
I know that when using web service the C/AL must not contains code like CONFIRM, ERROR,... And that's the case I don't have any UI related functions but i still have this error when my dll is called.
Does someone already had this error?
Do you have any idea of what i can do?
Answers
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
There is no progressbar or any UI related stuff that appears when i launch the codeunit from the RTC...
The data are stored in the NAV database as BLOB and each night I have more than 1000 lines to unpack and parse (the zip contains some XML that i have to add to some tables).
So it looked to me easier to do that in NAV.
Yesterday I also tried to launch my code with a report and from the command line like that :
But then i have this message :
Microsoft Dynamics NAV Security Notice
You are about to connect to 'navDb on server 'navSrv', which is not your current default connection setting.
This can create a security risk.
Do you want to continue?
Yes No
As i would like to launch this line from task scheduler, i'm stuck...
What was your idea with the windows scheduler?
The error message is a bit misleading in this case.
When running code from Web Service, the code must not use the .NET variables with RUNONCLIENT as that would mean "client callback". Therefore modify it so that the zip library is on the service tier and then it should work fine.
Regards,
Igor
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
But...
If I keep RunOnClient to yes and copy my .net dll to the service tier I have the same error message (Callback functions are not allowed).
If I switch RunOnClient to False then I have to copy my .net dll to the NAV server isn't it? Then i have this error message : Which means : This message is for C/AL programmers : could not create an instance of the .net assembly...
I should missed something...
Regarding the error with RunOnClient = No.
That really sounds like the library or some of its dependencies are not accessible from the service tier. Your DLL should be in Add-Ins directory of ServiceTier. Any dependencies like SharpZLib should be there or in global assembly cache as well.
As you said the code works from RTC, I assume that your function is static and so it doesn't require instance creation first (by using constructor). In that case I would be really looking at why the DLL has not been found ... I would e.g. restart the services, double check that I have placed correct DLLs into correct service tier folders, etc.
Regards,
Igor
Now it's ok.
ichladil you were right, my error was that i had copied the addin(and their dependencies) in the wrong folder.
With RunOnClient to False we have to copy the addin in the NAV Server (serverTier) and in the NAV Web server(serviceTier, if it's different from the server and if you use some ws).
I did that before but not in the good folder.
There is some folders for each database installation.
On the serverTier :
\Classic\Add-ins
\RoleTailored Client\Add-ins
\NavDatabaseXXX\Add-ins -->Add Addins here
\NavDatabaseYYY\Add-ins -->Add Addins here
\Service\Add-ins
On the serviceTier :
\NavDatabaseXXX\Add-ins -->Add Addins here
\NavDatabaseYYY\Add-ins -->Add Addins here
\Service\Add-ins
děkuji!