Code highlighting

Showing posts with label XML. Show all posts
Showing posts with label XML. Show all posts

Friday, June 27, 2014

Tool: Update: Automated way of setting up the Application Integration Framework

In November 2009 I have posted a blog post that presented a tool I wrote for quickly setting up AIF for testing purposes. You can find the original post here.

I have since received requests to upload a new version of that tool, that would work with AX 2012 R2.
Well, now, only 5 years later :), here is the updated tool, that works with AX 2012 R3 (Note: should also work with R2, but I have only tried it on R3).

You can download the xpo from my OneDrive.

To briefly describe the changes, as compared to the version from AX 2009:

  • There is no longer a concept of endpoints in AX 2012. Instead, there is a concept of inbound and outbound ports, so I have replaced the corresponding creation so that 1 inbound and 1 outbound ports are created, both using the File System Adapter, and dropping the files in a location on drive D. Note, that I have not done anything in terms of ensuring AOS has access to that folder, so if that is not working, ensure the right access is granted.
  • Channels are now created implicitly for each port, depending on the Adapter class you select.
  • I am not explicitly creating data policies now, which seems to mean all XML fields are enabled. If you want to restrict the schema to only certain fields, you will need to deactivate the port, and modify the data policies accordingly manually.

Note: Only services for Invent*, EcoRes* and WHS* prefixes are registered, and only their service actions are added to the ports. If you need additional actions in your tests, modify the code and add the extra prefix.

I have tested that the WHS ASN service works after executing the tool, both for inbound and outbound, and will describe the use of this service in a blog post on the SCM msdn blog shortly. If you however find stuff I have missed, let me know.

Thanks

Friday, November 06, 2009

How to quickly set up Application Integration Framework (AIF) for testing Axd documents

Purpose of this post
Part of the test effort on our team at MDCC goes for verifying the Axd documents shipped with the Dynamics AX application.

As many people find it hard to setup AIF, I have tried to help them by creating an automated way of doing the initial setup, which can be used for testing the documents using a 1-box setup and FileSystem transport adapter.

Download link
From the following link, you will be able to download an X++ class that initializes all the entities required for AIF to work, like the endpoints, transport adapters and channels, services, their actions and action policies.
Note, that since I am working on the Inventory team, I am filtering out the services accordingly. You can easily extend/modify this to suite your specific needs by changing the filter or adding new ones in classDeclaration and method main

Download xpo

Example from the standard application
To give a specific example, I encourage you to try sending a selected item electronically in form of an XML file right after executing the job.
To do that, navigate to Inventory Management\Common forms\Item details and press Send electronically button. Fill in the values for endpoint, filter on a specific item(s), and press OK.

Your screen should look similar to this:


Processing the document
The document is successfully placed into the queue for processing and sending through the gateway. If you have a batch job for processing AIF services up and running, you will soon see a file in the outbound files folder setup on the outbound channel.
If you would like to learn, how to set up the batch jobs for this, follow the below link: Start and stop the asynchronous AIF services

In order to avoid having to set the batch jobs up, I have added 2 extra methods to the class for starting the processing of inbound and outbound messages.

public static void ProcessOutboundDocuments()
{
    new AifOutboundProcessingService().run();
    new AifGatewaySendService().run();
}
public static void ProcessInboundDocuments()
{
    new AifGatewayReceiveService().run();
    new AifInboundProcessingService().run();
}


Just call the DEV_AifInitialSetup::ProcessOutboundDocuments method from a job, and the document will be automatically processed and sent on its way to the outbound documents folder.

Output
The resulting XML file for the item should look similar to the following: