application integration framework & adaptor ppt
TRANSCRIPT
Application Integration Framework A way of communication
Prepared By:- Aditya Negi
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
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.
Application Object 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.
Serv
ices 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 the WCF 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 use Web services are processed
synchronously and therefore are not queued. AX deploys the service that is
based on Web Services Description Language (WSDL) to a subfolder of the virtual directory that is associated with
the Web site that you provide.
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.
How To Create the Document Services
Tools Application Integration Framework Create Document Service
> 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
Now Open The Visual Studio To Create The New Console Application Project. Open Solution Explorer , Reference select Add Service Reference. Paste The WSDL URL in Address Bar Click GO button.
Next Debug the Service . Enter the Values. Go and Check Table Finally You are Create the Simple Document Services.
“”
Custom services can be used by developers to expose any X++ logic,
such as X++ classes and their members, through a service interface.
SysEntryPointAttributeSysEntryPointAttribute 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.AifCollectionTypeAttributeAifCollectionType 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.
Create One Table. Go To 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 .
Create Operations in Product Info Service Class Insert , Delete , Update and Read
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
Go To Service Node Reference Properties Service assign your Service Next RC Service Node Select Deploy Service Go To INBOUND Control you will get WSDL URLOpen Visual 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
Create Record: And I Call Method GO and Check Tables Record is Inserted
Delete Operation Next Call The Service ,Record Is Deleted GO and Check Tables Record is Deleted
Up Date Service Call The Update Service Go And Check AOT Table Record Is Updated
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 Service
Query Service
Metadata ServicesEnables 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.
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:
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.
User-defined queryA query that is defined by using the Query Metadata class which is found in the
metadata service.
User Session Service – Enables you to return information about the current Windows 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 Application Object Server (AOS). The system
services are automatically installed as part of the setup process and are always available.
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.
Conclusion The following table summarizes some of the key scenarios for
all the service types in Microsoft Dynamics AX 2012.
AdaptersAn 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
NetTCP adapterThis adapter provides for synchronous exchanges by using WS-* standards support over the Transmission 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 (using TCP)
netTcpBinding is best when WCF service and its clients are in intranet infrastructure. As it supports only TCP 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 host WCF 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 from
Windows features• Enabled Protocols for net.tcp and
net.pipe
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.
:-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 in WCF.
Create a queue. A queue for inbound messages can be either private or public; a queue for outbound messages must be public.
• Go To System Administrator->Setup-> Batch Group>Create new Batch Group• Select your new batch group and click on Batch Servers Tab and add server
reference from remaining server to selected server.
> Create New Batch Job>System Administrator-> Inquiries- Batch Jobs->Batch Job> Set Task 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.
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.
> Create XML file in C:\ Drive with “SOCreate.Xml” name everything should be in same lineCreate Visual Studio Project > Open Visual 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)
> 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->Message Queuing->Public Queues.> Right click on your queue and select properties and copy value of ID and paste this to your XML file inside.
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 directoriesCreate 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.
Create the batch jobOpen 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)
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.
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.
Flow of Adaptors & Distinguish In which scenario what appropriate binding can be used or what is getting used
Processing messagesWhen 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
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 Language Transformations (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 the AIF schema.)
• http://deepakdyanmicsax.blogspot.in/2016/03/aif-xslt-transformation.html
PipelinesYou 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 and Application Integration Framework|Value substitution maps