Debug in AIF Classes
Enable Debug on AIF Classes in AX 4.0
There is a Piece of code in \Classes\AifOutboundProcessingService\run or \Classes\AifInboundProcessingService\run
runas(message.sourceEndpointAxUserId(),
classnum(AifInboundProcessingService),
staticmethodstr(AifInboundProcessingService, processAsUser),
[message.pack(), messageId]);
just comment this code and change the scope of the static method processAsUser from the same class to public and then call it exactly as below in the run method
AifInboundProcessingService::processAsUser([message.pack(), messageId]);
this would allow you to debug the code in Aif and the Axd's but make sure you delete these changes once you complete your debugging.