Tuesday 4 October 2011

How to debug AIF in AX 2009

Hi Friends,
This is my first post .
I was working on one AIF project . As you know , for any developer life starts with debugger , when I started debugging for AIF classes , to my surprise I was not able to debug the AIF classes , even I tried with "breakpoint" as well . As I struggled with this, I thought , it will be good to share this experience

We have to update the method runasWrapper of class AifInboundProcessingService as below :


public static void runAsWrapper(AifWindowsUser runAsUserId, container messageIdContainer)
{
    AifGatewayQueue   gatewayQueue;
    userId            axaptaUserId;
    AifMessageId      messageId;
    int               messageIdContainerIdx = 1;
    AifMessage        errorMessage;
    AifInfoLog        aifInfoLog;
    SysExceptionLog   exceptionLog;
    ;

    aifInfoLog = new AifInfoLog();
    try
    {
        // Convert to Axapta UserId
        axaptaUserId = AifEndpointUser::getAxaptaUser(runAsUserId).Id;

        new RunAsPermission(axaptaUserId).assert();

        // BP deviation documented
       /* runas(axaptaUserId,
                classnum(AifInboundProcessingService),
                staticmethodstr(AifInboundProcessingService, processAsUser),
                messageIdContainer);
*/
        AifInboundProcessingService::processAsUser(messageIdContainer);
        CodeAccessPermission::revertAssert();
    }

Here we have commented the runas (.....) and added AifInboundProcessingService::processAsUser(messageIdContainer);

Hope this will help you guys as well.

PS : Make sure you have enabled debugging in client and server configuration as well

Will be back very soon , happy DAXing.

2 comments:

  1. had I read ur post before...I wouldn't have to show the blank face in the interview.. :)

    ReplyDelete