"Client callback not supported" when consuming a codeunit with run report methods

Alexander95Alexander95 Member Posts: 17
Using Microsoft Dynamics NAV 2009

I am getting the same error message whenever I debug my C#, which consumes a published web service codeunit. The codeunit takes parameters and designed to run either another codeunit, or a report. When passing parameters to run a codeunit through the C# program, it runs successfully, however if the parameters are changed to run a report instead, I get my error as stated above.

I have researched and removed some problems which I may believe to be the problem. I have removed and function which would cause a dialog box, or I have used GUIALLOWED for them.

I believe the problem may be this. If I try to run a report in the classic client, I am required to select a company before doing this action. This is different for running a codeunit as I am not asked for a company to select. My theory is to add some code into the C# console application, so that before it runs the report, it selects a company beforehand.

I am struggling to solve this error, so any help or advice is welcomed. I am still new to web services.

Answers

  • KishormKishorm Member Posts: 921
    What kind of a report is it... is it a ProcessingOnly report or a proper report that prints something?

    If it's a report which prints something (i.e. not ProcessingOnly) then have you created an RDLC report layout for it?

    I don't think you can run a classic report in a web service as it will be running on the NST (middle tier) when called via a web service.
  • RockWithNAVRockWithNAV Member Posts: 1,139
    As a protocol of Web Services if there's a dialogue box that needs to be confirmed then you will always face this error until and unless you deliberately make that off. I too faced this bu replacing an Automation Variable with .NET solves my case.
  • Alexander95Alexander95 Member Posts: 17
    @Kishorm

    It is a report that prints. In the C/AL of the report, it produces a .txt when run.

    To your final point, I'm not sure if I made myself completely clear. The published webservice is a codeunit, but takes parameters in it's C/AL method to run codeunits/reports, which are available in the classic client, without the object being run published as websevice. The webservice runs codeunits fine, but does it fail for reports for what you said in your answer?
  • Alexander95Alexander95 Member Posts: 17
    @RockWithNAV

    Yes, the dialog box is the only reason why I am getting an error. When running a report normally in the classic client, I am prompted for a company name. I am not asked for a company when running a codeunit, so I believe this is where my problem lies.

    I am thinking that this is a problem which must be solved in NAV as my C# program is only designed to pass on parameters, so it can't handle an user interaction.If this is right, how and where would I solve this issue?
  • KishormKishorm Member Posts: 921
    Can you include a screenshot of the dialog box you are getting? If it's the standard Company Open dialog box then that is a red herring because you wouldn't get that in a web service as the URL itself will include the company.

    Have you seen the questions I asked in my initial reply above?

    Also another thought... are you using any automation server variables in your report? If you are then it could be that you are instantiating them to run on the client (3rd parameter of the CREATE function) - this would also result in the error you are getting.

    Related to the above is are you using the "Excel Buffer" in your report as this uses client side automation objects.
  • Alexander95Alexander95 Member Posts: 17
    Firstly, my apologies as I am using a ProcessingOnlyReport.

    I can't send a screen shot right now, but I will later. I do agree with your first point, that it should include the company in the URL.

    Yes, I use the create function to create an output file when a report is run. This would classify as an automation server variable, correct? However, when I run parameters to run a codeunit instead of a report in the C# application, it is able to create a file without any errors.
  • KishormKishorm Member Posts: 921
    There are 2 CREATE function in C/SIDE - firstly for a File variable and then also for an Automation variable - the 2 functions are different. If you are using it on a File variable then that's not a problem.

    Another thought, are you using the "3-Tier Automation Mgt." codeunit - note that this also uses client side Automation objects in some functions such as SilentUpload or DownloadToFile etc...

    P.S. If it's not the above then if you can include the code in your report then it might be a little easier to spot the problem.
  • Alexander95Alexander95 Member Posts: 17
    This is the part of the code which is causing the error you suggested.


    // create file
    CLEAR(fOut);
    fOut.TEXTMODE(TRUE);
    IF ISSERVICETIER THEN BEGIN
    tTempFileName := cu3TierAutMgt.ServerTempFileName('','dat');
    fOut.CREATE(tTempFileName);
    END ELSE BEGIN
    IF NOT fOut.CREATE(tFileName) THEN BEGIN
    CurrReport.QUIT;
    EXIT;
    END;
    END;

    The CREATE function is for a file, but you mentioned the 3-Tier Automation Mgt. CU. This does exist in the code. Is this the problem? If so, what are your suggestions?
  • KishormKishorm Member Posts: 921
    That looks OK, the ServerTempFileName() function doesn't use any Automation objects so it should be OK. Just to double check that it is the above code can you...

    1) Rem out the code above
    2) Rem out any code that uses the fOut variable (e.g. fOut.WRITETEXT(...))
    3) Leave all other code as is

    ...with the above changes do you still get the same error?
  • Alexander95Alexander95 Member Posts: 17
    No, the error seems to no longer be present, and it still produces a file. If I run the C# application outside of the same server though as the classic client, I get a new error "Either the caller does not have the required permission or the specified path is read-only". Running the program on the same server is fine. Do you know what permissions I need?
  • KishormKishorm Member Posts: 921
    More questions...

    1) When testing the 2 different scenarios - are you logged into windows using the same account? If not then it sounds like the account giving the error does not have rights to create the file

    2) There must be some other code assigning a value to the tTempFileName variable - what is the code. It's the path here that is likely causing the error

    3) What is the code in the ServerTempFileName() function in the "3-Tier Automation Mgt." codeunit, it should be...
    TempFile.CREATETEMPFILE;
    FileName := TempFile.NAME + '.' + FileExtension;
    TempFile.CLOSE;
    
  • Alexander95Alexander95 Member Posts: 17
    1) Yes, I am using the same user on both servers. The same error occurs only when it is not run on the same server as the classic client.

    2) There is this code, but I have removed it as it uses a CU containing automation objects.


    IF ISSERVICETIER THEN BEGIN
    cu3TierAutMgt.DownloadToFile(tTempFileName,tFileName);
    ERASE(tTempFileName);
    END;

    3) I don't have the permissions to view the code in CUs unfortunately so I can't tell you at this stage.

    Sorry for the late reply, but I have been busy.

  • krikikriki Member, Moderator Posts: 9,110
    [Topic moved from 'NAV/Navision Classic Client' forum to 'NAV Three Tier' forum]

    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


Sign In or Register to comment.