Skip to main content

Notifications

Microsoft Dynamics AX (Archived)

Service error on DocuActionArchive.add()

Posted on by 455
Hello everyone,
I have a working code in AX but when invoked through a service from outside it throws an exception.
I am using DocuActionArchive class in my code for file attachment.
I have following lines of code that refer to this class.
DocuActionArchive archive;
archive = new DocuActionArchive();
archive.add(docuRef, filePath);
The service throw following exception:
System.ServiceModel.FaultException: Exception of type 'Microsoft.Dynamics.Ax.Xpp.InvalidRemoteCallException' was thrown.
It errors out on line: archive.add(docuRef, filePath);
Looks like it cannot call the add method in the DocuActionArchive class. I changed the property of this class from Run on Client to Run on Server but still get this error.

*This post is locked for comments

  • Samy123 Profile Picture
    Samy123 455 on at
    RE: Service error on DocuActionArchive.add()

    Thanks Martin for your advice.

    I implemented the Server version of this class and it worked!

  • Verified answer
    Martin Dráb Profile Picture
    Martin Dráb 230,188 Most Valuable Professional on at
    RE: Service error

    There is a reason why this class has Run on = Client - it uses resources that works only on client. In particular, I believe that add() uses WinAPI, which itself is bound to client. If you really want to use DocuActionArchive, you'll have to change the implementation. A better approach may be creating a separate class for your purposes.

    Note that I don't have any AX 2012 environment on hand, therefore I can't look at the code. Sorry if I don't remember it correctly.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,253 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,188 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans