2. Microsoft Dynamics AX Application Integration Framework (AIF) enables companies to integrate and
communicate with external business processes and partners through the exchange of XML over various
transport media. AIF enables both business-to-business and application-to-application integration
scenarios.
Consist Of
Services and AIF architecture and planning
Deploy services and AIF
Services and AIF operations
Services and AIF development
Services and AIF security and protection
Troubleshoot services and AIF
Key Concepts
Application integration
Services, service operations, and service groups
Integration ports
Adapters
Messages and transforms in AIF
Developing with Services and AIF
3. AX 2012 exposes its functionality through services that are based on Windows Communication
Foundation (WCF) and hosted on Application Object Server (AOS).
External applications and client applications on the local area network consume AX
services by accessing them directly from AOS.
The AX service invokes the necessary business logic to process the inbound request
message.
The AIF response postprocessor then returns the response to the client.
4. ApplicationObject Server (AOS) is the
Windows Communication Foundation
(WCF) service host for Microsoft Dynamics
AX 2012 services that are exposed to users
and applications on an intranet.
Services
Document Services
Custom Service
System Service
To consume services over the Internet,
you must host services on Internet
Information Services (IIS). Services that are
hosted on IIS use theWCF message routing
service. IIS routes all service requests to AOS.
All service requests are processed on AOS,
regardless of whether they originate on the
Internet or an intranet. AOS then returns a
response to the service consumer via IIS.
Exchanges that are configured to useWeb
services are processed
synchronously and therefore are not queued.
AX deploys the service that is based onWeb
Services Description Language (WSDL) to
a subfolder of the virtual directory that is
associated with theWeb site that you
provide.
5. Document Service
Document services are query-based services that can be used to exchange data with
external systems by sending and receiving XML documents.These documents represent
business entities, such as customers, vendors, or sales orders.
6. HowTo Create the Document Services
Tools Application Integration Framework Create Document Service
7. > Click Finish button, it Will Generate the Project .
> Now Create New Service Groups and Select Deploy Service Group
> Now open a New work space and go at System Administration module and open in bound port under
Application integration framework
8. Now OpenTheVisual StudioTo Create The New Console Application Project.
Open Solution Explorer , Reference select Add Service Reference.
Paste The WSDL URL in Address Bar Click GO button.
9. Next Debug the Service . Enter theValues.
Go and CheckTable
FinallyYou are Create the Simple Document Services.
10. “
”
Custom services can be used by developers to
expose any X++ logic, such as X++ classes and their
members, through a service interface.
SysEntryPointAttribute
SysEntryPointAttribute defines the authorization checks that will be performed when a method is
called from the server.This attribute must be set on all the service operations. If the value is
“true”, it means that authorization checks will be performed for all the tables accessed in
the method and if set to “false”, no authorization checks will be performed.
AifCollectionTypeAttribute
AifCollectionType Attribute is used when you want to use a collection as a return type or in a parameter
of a service operation.This attribute defines the type of data a collection contains.
11. Create OneTable.
GoTo Classes Create One New Product Info Class Select Run ON property on Server.
Create user Define Properties .
Create Another Product Info Service Select Run ON Property Server .
12. Create Operations in Product Info Service Class
Insert , Delete , Update and Read
13. Next go to AOT Under Service Node Create New Service
Properties Class Service Name(ProductInfoServiceClass)
Select Operations Checkboxes and click OK Button to operation
Service Group Select New Service Group Autodeply yes New Service Node Reference
14. GoTo Service Node Reference Properties Service assign your Service
Next RC Service Node Select Deploy Service
GoTo INBOUND Control you will get WSDL URL
OpenVisual Studio Create NEW Console Application Project and Goto Solution Explore in Reference
Node RC Select Add Reference Past
WSDL URL in Address BAR and Click GO button
15. Create Record:
And I Call Method
GO and CheckTables Record is Inserted
16. Delete Operation
Next CallThe Service ,Record Is Deleted
GO and CheckTables Record is Deleted
17. Up Date Service
CallThe Update Service
Go And Check AOTTable Record Is Updated
18. System services are
Windows
Communication
Foundation (WCF)
services that are included
with Microsoft Dynamics
AX.These services enable
clients to interact with
and retrieve system
information.The system
services include the
following:
System Service
Metadata Services
User Session ServiceQuery Service
19. Metadata Services
Enables you to retrieve information
about elements in the AOT.You can
retrieve metadata for labels, menus,
menu items, tables, extended data
types, data types, enums, queries, web
menus, web menu items, info parts,
cues, dimensions, form parts, web
controls, service groups, and services.
The metadata service should be used
when you want to return information
about the structures in Microsoft
Dynamics AX to a client application. For
example, if you want to return
information about a table such as what
indexes exist on that table, you can use
the metadata service.
20. Query Services
Static Query
User-defined Query
Dynamic query
Enables you to issue a query for data
without using an Application
Integration Framework (AIF) document
service or creating a custom service.
The query service returns data in a
dataset and implements a paging
mechanism so that you can manage
queries that return large amounts of
data.
When you call the query service, you
can specify the query to run in one of
three different ways:
21. Static query – A query that is
already defined in the AOT under
the Queries node.
Dynamic query – A query that is
defined in an X++ class that extends
the AifQueryBuilder class.All query
logic resides in the query builder class.
22. User-defined query
A query that is defined by using the
Query Metadata class which is
found in the metadata service.
23. User Session Service – Enables you to return information about the currentWindows user.You can return
information such as the user’s default language, default company, default company time zone,
permissions to access-controlled items, and so on.
The system services are hosted by the ApplicationObject Server (AOS).The system services are
automatically installed as part of the setup process and are always available.
24. How to distinguish between the three key service types
The following table provides more information about how to distinguish between the three key service
types, based on certain deployment and usage parameters.
25. Conclusion
The following table summarizes some of the key scenarios for all the service
types in Microsoft Dynamics AX 2012.
26. Adapters
An address that indicates where the endpoint can be found.
A binding that specifies how a client can communicate with the endpoint.
A contract that identifies the operations available.
In AX 2012 services and Application Integration Framework (AIF), integration
ports use adapters.These adapters enable AX to communicate by using
various transport protocols.
AX 2012 provides the following four adapters that represent predefined
bindings:
Adapters
HTTP
File system
MSMQ
NetTCP
27. NetTCP adapter
This adapter provides for synchronous exchanges by using WS-* standards support over theTransmission Control
Protocol (TCP) transport.This adapter corresponds to the WCF-NetTcp binding in Windows Communication
Foundation (WCF).
Client contacts the AOS instance directly on the supplied IP address and port number (usingTCP)
netTcpBinding is best when WCF service and its clients are in intranet infrastructure. As it supports onlyTCP protocol
and not HTTP so service cannot be accessed over internet.
This is secure binding is used to send binary encoded SOAP messages with in intranet computers. It supports
reliability, transaction and security. If your using netTcpBinding and hostWCF service in IIS, you need to make some
settings on system
• In Services window:-Start this services
• Net.Tcp Listener adapter &Net.Tcp Port
Sharing services
• WCF Non-Http Activation fromWindows
features
• Enabled Protocols for net.tcp and net.pipe
28. HTTP adapter –This adapter provides for synchronous message exchanges by using an HTTP or HTTPs transport.
This walkthrough demonstrates how to use an inbound integration port together with the HTTP adapter to read a
table data from Microsoft Dynamics AX.
29.
30.
31. :-MSMQ adapter –This adapter provides support for queuing by using Message
Queuing as a transport. Message Queuing is also known as MSMQ. Message Queuing
is a type of asynchronous communication.This adapter corresponds to the WCF-
NetMsmq binding inWCF.
Create a queue. A queue for inbound messages can be either private or public; a queue for outbound messages must be public.
• GoTo SystemAdministrator->Setup-> Batch Group>Create new Batch Group
• Select your new batch group and click on Batch ServersTab and add server reference from
remaining server to selected server.
32. > Create New Batch Job>System Administrator-> Inquiries-
Batch Jobs->Batch Job
> SetTask select your job and click on view tasks.
> Set recurrence for newly created job. Select job and click
on Recurrence
> Change the status of your job select job and click
Functions-> Change Status->Waiting.
33. Create Service > System Administrator->Setup-> Services and Application Integration Framework->Inbound Port.
>Press Service Operation button and select SalesSalesOrderService.Create.
>Select Customize documents check box and click Data policies button . Select custAccount and
ItemId element.
>Activate newly created service.
34. > Create XML file in C: Drive with “SOCreate.Xml” name everything should be in same line
CreateVisual Studio Project
> OpenVisual Studio 2010-> New->Project-> C# (Console Application)
> Right Click on Project name in Solution Explorer and click on Add Reference
Select System.Messenging
>Write Following Code:-
>At the command prompt, run the MSMQ client application.(start MSMQClient queuename)
35. > How to Check Status of Message
System Administrator-> Periodic->Services and Application Integration Framework-> Queue Manager.
> How to check Exceptions
System Administrator-> Periodic->Services and Application Integration Framework-> Exceptions.
> If it is Generate Schema error then
Go to Server Manager->Features->MessageQueuing->PublicQueues.
> Right click on your queue and select properties and copy value of ID and paste this to your XML file inside.
36. The response message contains an element titled <RequestMessageId>.This element contains the
same GUID value that you provided for the <MessageId> element in the original request document.You
can use this value to match responses to requests, a process called correlation.
File system adapter –This adapter provides support for the asynchronous exchange of documents
through file system directories
Create the file system directories –To enable the document exchange, you must create the following two
folders:
A folder to contain the source document for the request. Name this folder In.This is the folder from
which AIF will get the original sales order that is written in a custom schema.
A folder to receive the AIF response. Name this folder Out.
37. Create the batch job
Open the Batch job form. Click System administration > Inquiries > Batch jobs > Batch jobs.
Create a new batch job.
Add four tasks that use the following classes to the batch job: AifGatewayReceiveService, AifGatewaySendService, AifInboundProcessingService,
andAifOutboundProcessingService.
Set a recurrence interval for the batch job. For testing purposes, it is convenient to set the interval to one minute.
To start the batch job, change its status to Waiting.
• Select the service operation:-
SalesSalesOrderService.create
• Configure the data policies:-Element name column
and then select Enabled for the following elements
CustAccount (/SalesOrder/SalesTable/CustAccount)
ItemId (/SalesOrder/SalesTable/SalesLine/ItemId)
38. File system Adaptor /Outbound:- Here we will send sales conformation report to the desire folder in xml format. For
this activity, we will per form some task to achieve this requirement .
>Open the form of Outbound ports
>select desired action & activate the port
>New batch job & assign - AifOutboundProcessingService responsible for outbound processing & AifGatewaySendService that will save XML files in the folder of URI.
>Document will be pushed in the Message queue first and then a file will be created.
39. Print management for clients
>Choose Print archive as a Destination to avoid the real printing and to generate an XML file.
>when I confirm a sales order for this client I get after within one-two minutes an appropriate XML file in the folder.
40. Flow of Adaptors & Distinguish
In which scenario what appropriate binding can be used or what is getting used
41. Processing messages
When you use an enhanced integration port for services and AIF, you can perform custom processing of data, such as
XML documents, as each message passes through the integration port. Enhanced integration ports use the following
two concepts to process messages during inbound or outbound exchanges
Processing
Transforms
.NET assembly
XSLT
Pipelines
XSL transforms
.NET assembly
transforms
Value
substitution
42. Transforms
(transform components that are called before the message is stored in the gateway queue)
The gateway queue manages the processing of messages.This is where messages are stored before they are processed by the service
operation.The gateway queue can only accept XML messages.
Transforms provide an extensible framework that developers can use to apply Extensible Stylesheet LanguageTransformations (XSLT)
or .NET-based transforms to messages. .Net-based transforms can convert messages to or from any proprietary format.
Transforms process the whole message. Headers are included in the processing.
Transforms apply only to asynchronous exchanges.
• .NET assembly(Microsoft Dynamics AX services and AIF can process XML
documents only if the documents comply with the service XSD. If an incoming
document is based on XML but uses a different schema, you can use Extensible
Stylesheet Language (XSL) to transform the document to the AIF schema. )
• https://technet.microsoft.com/en-
us/library/gg863930.aspx
• XSLT(If an incoming document is not based on XML, such as
a comma-delimited file, you can use a .NET Framework
assembly to convert the file to theAIF schema.)
• http://deepakdyanmicsax.blogspot.in/2016/03/
aif-xslt-transformation.html
43. Pipelines
You can use pipelines to add custom processing to documents that are processed by an inbound or
outbound integration port. For inbound exchanges, pipelines are run after transforms. For outbound exchanges,
pipelines are run before transforms.
• Value Substitution :-The value substitution pipeline
components allows you to replace one value with
another based on a simple lookup table . for example,
when messages are sent to a vendor , you can replace
your currency code with the currency code of your
vendor , such as EUR to EURO. when the direction is
inbound, you can do the opposite substitution.The
value substitution is based on Extended Data
Types(EDTs).A value substituon map must be created
that contains a mapping between the internal and
external value for a specific EDT.These maps are set up
in the following form:-
System administration|Setup|Services andApplication
Integration Framework|Value substitution maps