web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Debugging AIF service operations

(0) ShareShare
ReportReport
Posted on by

Hi,

I'm fairly new to AX, so please bear with me. :)

I have an inbound port that uses a File System Adapter to process some XML.

Once the XML has been transformed into a message, one of the Service operations are called.

What I need to be able to do is to debug / trace what's happening inside the service operation.  There's some logic that's not correct in the class, but without the ability to debug or even output some values somewhere, I'm struggling to find the problem.

I've tried calling info("Made it inside the service operation class!"); at the top of the class, restarting the inbound port and then dropping the xml in the folder, but I can't find any output anywhere (even though I know the method gets run from the result of the operation).

If someone can suggest a way of debugging / outputing some data from a service, I'd be very grateful.

All the best,

Dave

*This post is locked for comments

I have the same question (0)
  • Verified answer
    Sohaib Cheema Profile Picture
    49,438 User Group Leader on at

    Like C# has MSIL or Java has bytecode, similary X++ has PCode or CIL

    Services in AX run under CIL, so you have to debug CIL.

    On TechNet guide is already available with details

    Also you can find many tutorials or blog posts such as one here

    You must have Visual Studio and you have to attach AOS exe process in VS, to debug services.

  • Suggested answer
    Rudi Hansen Profile Picture
    4,075 on at

    I stole this job somewhere that makes it possible to run the AIF Processing manually and then you can debug what is going on in most cases.

    The code is for AX2009, but it might work for 2012 as well.

    static void runAIFReceive(Args _args)
    {
        AifGatewayReceiveService        aifGatewayReceiveService;
        AifInboundProcessingService     aifInboundProcessingService;
        AifOutboundProcessingService    aifOutboundProcessingService;
        AifGatewaySendService           aifGatewaySendService;
    
        boolean                         runGatewayReceiveService        = false;
        boolean                         runInboundProcessingService     = false;
        boolean                         runOutboundProcessingService    = true;
        boolean                         runGatewaySendService           = true;
        ;
        if(runGatewayReceiveService)
        {
            aifGatewayReceiveService = new AifGatewayReceiveService();
            aifGatewayReceiveService.run();
        }
    
        if(runInboundProcessingService)
        {
            aifInboundProcessingService = new AifInboundProcessingService();
            aifInboundProcessingService.run();  // pass true for debug mode
        }
    
        if(runOutboundProcessingService)
        {
            aifOutboundProcessingService = new AifOutboundProcessingService();
            aifOutboundProcessingService.run();
        }
    
        if(runGatewaySendService)
        {
            AifGatewaySendService   = new AifGatewaySendService();
            AifGatewaySendService.run();
        }
    }
    


  • Rudi Hansen Profile Picture
    4,075 on at

    Hi David.

    So did my job help you?

  • Suggested answer
    UmesH@ Profile Picture
    810 on at

    For Debugging AIF Service you Can Check This.


    ·         First, you’ll need Visual Studio installed on the same machine where AOS reside. You’ll also need Dynamics AX Application Explorer component installed as well. The AX Application Explorer is a Visual Studio add-on that is used browse the AX AOT (Application Objects Tree) within Visual Studio. You can install it from the Microsoft Dynamics AX CD by choosing Developer Tools > Visual Studio Tools.
    ·         Next, open Visual Studio and in the Application Explorer pane expand the AOT (Application Objects Tree) and navigate to the AIF Service. Expand the methods given here and open the method that you want to debug. Add a breakpoint to the code line that you’re interested in.
    ·         Since AIF Services code is compiled into CIL (Common Intermediate Language) and run on the server, to debug it you’ll need to attach the debugger to the server (Ax32Serv.exe) process. For this, select Debug menu > Attach to Process. Then select ‘Ax32Serv.exe’ and press ‘Attach’. Wait for until the code is attached to the process and all the relevant files and debugging symbols have been loaded into the memory.
    ·         Now, make the service call from the client application and the control will eventually stop over the break point.

    Thanks.

  • Community Member Profile Picture
    on at

    Hi Rudi,

    Thank you for your help. It didn't help in this instance (managed to get VS attached) but I will definitely bear it in mind for the future.

  • Community Member Profile Picture
    on at

    Thanks Sohaib, managed to get VS attached and traced the problem. :)

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans