Sometimes it is a pain to create a .NET application and attach a debugger to the AOS service just to diagnose a problem with an AIF service. It is possible to do all debugging inside of AX. This example is for a standard AIF document service, however, you can also do the same for a custom service in a way which is even easier.
As a prerequisite, the inbound port must have document version logging enabled. If not, deactivate it, enable logging, then activate it.
1. Find the exception and its message ID
/System administration/Periodic/Services and Application Integration Framework/Exceptions
Save the Message ID from this screen.
2. Get XML from AIF history
/System administration/Periodic/Services and Application Integration Framework/History
Filter on the Message ID, click "Document Logs" then save the document.
3. Modify XML to remove the entity key list, and keep the key because it is needed in the job.
4. Create a job for debugging
static void testAifXml(Args _args)
{
#file
AifEntityKey aifEntityKey;
AxdSalesOrder axdSalesOrder;
FileName fileName = @"\\a\b\c\4BA32F0A-F7FC-46FD-8DB0-ABB04A6F4ECE.xml";
Map map;
XmlDocument xmlDocument;
map = new Map(Types::Integer, Types::Container);
map.insert(fieldNum(SalesTable, SalesId), ['SO000037']);
aifEntityKey = new AifEntityKey();
aifEntityKey.parmTableId(tableNum(SalesTable));
aifEntityKey.parmKeyDataMap(map);
new FileIoPermission(fileName, #io_read).assert();
xmlDocument = XmlDocument::newFile(fileName);
CodeAccessPermission::revertAssert();
axdSalesOrder = new AxdSalesOrder();
axdSalesOrder.update(aifEntityKey, xmlDocument.xml(), new AifEndPointActionPolicyInfo(), new AifConstraintList());
info("Done");
}
No comments:
Post a Comment