RSS

Tag Archives: aif

AIF – How to get a better error message and stack trace for a failed document?

How many times when working with AIF you got an error and have no idea what caused the issue. The document fails for many reasons and what you get is a very generic error message. Debugging AIF is a painful process and time consuming. Below is the trick that we can find out more descriptive error message and even a stack trace.

image

image

Run the job below and replace the GUID with the GUID from the document that failed

static void TestOutboundMessage(Args _args)
{
    guid id = str2guid("{BCE9B13D-3F3C-497F-A566-55606C3F19B4}");
    
    AifQueueManager document;

    select firstOnly document where document.MessageId == id;

    // This static method is declared as private and this trick is to avoid changing the access specifier on the class
    new SysDictClass(classNum(AifOutboundProcessingService)).callStatic('processAsUser', [document.MessageId]);

}

Refresh and review the error again, you will see a more descriptive message and a stack trace that can save your life.

image

Advertisements
 
Leave a comment

Posted by on August 26, 2014 in Development

 

Tags: , , , , , ,

AIF – How an external .NET web app can invoke AIF services

Issue:

A .NET Web application calls an AIF service but keeps getting an error “Logon failure: unknown user name or bad password.“.

When i created my own .NET Console application to consume this service. I had no issue making a request.

What seems to be the problem? Permissions? Roles? Cross Domain? Trusted intermediary?

Solution:

Note: I assume you know how to make service request through .NET. I only show how to set up from AX side.

1. Create a Custom Service

You can use any service available out of the box or create a new one. In my example below, I created a custom service

2. Create a “Claims user”.

System Administration > Common > Users > Users > New User

clip_image002

IMPORTANT: Make sure you have to create a role and privilege with all necessary access to entry points as well as tables that you use

image

3. Setup your custom service as “Enhanced” port with “Trusted Intermediary users”

clip_image004

4. Add super user and claim user

clip_image006

Additional Information

You can read more about Trusted Intermediary from this blog.
http://daxmusings.codecrib.com/2011/11/trusted-intermediary-in-aif-services.html

http://stackoverflow.com/questions/18704978/cannot-connect-to-ax-web-service-form-asp-net-but-can-from-console-application

The only additional setup up that i create is to assign a Role to  the claim user.

 
Leave a comment

Posted by on August 13, 2014 in Development

 

Tags: , , , ,

AIF Document Schema Caching Issue – “Invalid Document Schema”

Scenario: I created a ledger journal service that create general ledger journal by using Inbound Transform to transform a CSV file to XML.

  1. I generated a schema for my document for my service. (Note that i have additional custom fields in ledgerjournaltrans but then later i removed few fields and reupdated my document).
  2. i created a C# .NET application to transform the document using the schema above

When i started testing, i kept getting error with the schema for a field that i no longer used. If i dropped a XML file directly to my INBOUND folder, it worked fine but if i dropped it as a CSV and using Transform, it kept saying “Invalid document schema”. Note that the XML document is created by the same Transform class. I am thinking it could be some schema cache issue with the custom service.

Solution 1: The AIFRUNTIMECACHE table will hold cached details for the AIF document classes.  You should be able to clear this table if you believe it to be a caching issue.  In fact you can disable cache entire if you’re working in a DEV environment, if it’s production keeping cache enabled is recommended.  You can use the steps below to disable AIF runtime caching.

1. Open the AOT and expand form

2. Find the AIFGlobalSettings form and open it

3. Disable the caching check box

image

Solution 2: Rewrite your transform class with different class name and reload the assembly through Manage Transform

 
Leave a comment

Posted by on August 7, 2014 in Development

 

Tags: , , , ,

 
%d bloggers like this: