Sei sulla pagina 1di 42

Integrating Other Applications with Microsoft Dynamics AX

Dynamics AX 4.0 Other Versions

0 out of 5 rated this helpful - Rate this topic

The ability to integrate Microsoft Dynamics AX with other systems inside and outside of the enterprise is a common requirement. There are a variety of technologies you can use to integrate Microsoft Dynamics AX with other applications and exchange data, which include the following:

Application Integration Framework (AIF) Exchanges data with other internal or external systems. Business Connector Enables external applications to access Microsoft Dynamics AX data and invoke business logic. Common Language Runtime (CLR) Provides interoperability with external .NET components and enables you to create and execute managed components from within X++ code.

The integration components in all these methods interact with Application Object Server (AOS) as shown in the following figure. Therefore, integration between Microsoft Dynamics AX and any other system is done only through AOS.

Reproduced by permission from Greef, Pontoppidan, et al, Inside Microsoft Dynamics AX 4.0 (Redmond, WA: Microsoft Press, 2006) Microsoft Dynamics AX integration technologies For more information about the integration technologies available, see Greef, Pontoppidan, et al. 2006. Inside Microsoft Dynamics AX 4.0. 190-192. Redmond: Microsoft Press.
AIF

AIF provides an extensible framework within Microsoft Dynamics AX that enables the exchange of data. Data is exchanged in the form of XML documents. AIF replaces the Commerce Gateway for Microsoft Dynamics AX 3.0 (formerly Microsoft Business SolutionsAxapta 3.0) This framework provides a more secure business-to-business (B2B) and application-to-application (A2A) integration between your system and trading partners or other software systems. AIF has the following types of exchanges:

Adapter-based exchange An asynchronous document exchange that uses an adapter in Microsoft Dynamics AX and does not require the installation of Microsoft Internet Information Services (IIS). In this type of exchange, documents are moved through the system by using queues. Adapter transports supported by AIF are Microsoft Message Queuing (MSMQ), file system, Microsoft BizTalk Server 2006, and outbound Web services. Web service exchange A synchronous document exchange that uses Web services and requires that IIS be installed and configured to send and receive data. Because this type of exchange is synchronous, queues are not used. The Web services are generated automatically from the Microsoft Dynamics AX business logic. Developers with limited Web experience can easily create their own Web services. The Web service exchange differs from the outbound Web service adapter exchange in that it is synchronous, and it can accept requests. In contrast, the outbound Web service adapter cannot.

For more about AIF, see the Application Integration Framework Overview.
Business Connector

The Microsoft Dynamics AX Business Connector enables external applications to access Microsoft Dynamics AX data and invoke business logic. The Business Connector consists of the following components:

.NET Business Connector Provides interoperability with the Microsoft .NET Framework. Use these components for integration with external applications that are written in managed code and are built with the Microsoft .NET Framework. The .NET Business Connector requires the installation of the Microsoft .NET Framework 2.0. COM Business Connector - Provides interoperability with Microsoft COM. Use these components for integration with external applications that are compiled to the COM specification.

For more information about the differences between the .NET Business Connector and the COM Business Connector, see Differences Between .NET and COM Business Connectors.
CLR

CLR provides interoperability with external .NET components and enables you to instantiate and execute managed components from within X++ code. This interoperability is achieved with X++ language statements. These statements enable you to instantiate objects within Microsoft Dynamics AX and set them to objects in managed assemblies. In X++, the CLRObject and CLRInterop classes are used to wrap external objects. Calls can be made to external object methods through the object wrappers.

Application Integration Framework Overview


Dynamics AX 2009 Other Versions

8 out of 15 rated this helpful - Rate this topic Application Integration Framework (AIF) is the infrastructure within Microsoft Dynamics AX with which you can expose business logic or exchange data with other systems. AIF is comprised of three primary components:

Services - Enable you to expose business logic written in X++ as a service to be consumed by other applications. Within Microsoft Dynamics AX, you can create, customize, and publish services. Document services - A specific implementation of services in which the Microsoft Dynamics AX business logic is exposed through document services. Consume Web services - In Microsoft Dynamics AX, you can consume external Web services from your X++ code.

Services

In Microsoft Dynamics AX, you can build a custom service. This is done by creating a class in X++ that follows certain coding rules, defining a service interface by adding a new service to the AOT, and then linking the service interface to the service implementation class. You can then make the class methods available as service operations if the method parameters are serializable. Document Services

In Microsoft Dynamics AX, document services enable you to exchange data with external systems by sending and receiving data in XML documents. These documents represent business objects such as a customer, a vendor, a sales order, and so on. The AIF document services are designed to be extensible. Developers can create their own document services with the AIF Document Service Wizard or customize the services that ship with Microsoft Dynamics AX. AIF enables enterprise application integration scenarios with a variety of transports, including the following:

File system Microsoft Message Queuing (MSMQ) Microsoft BizTalk Server 2006

Web services

Within the AIF architecture there are two primary areas of functionalitythe transport components and the business logic components. Although transport functionality is separate from the business logic, the two are closely related.

The AIF architecture showing the transport layers above and the business logic layers below.

Transport
The transport components handle the transfer of business logic in and out of the system using XML documents. The elements of the transport layer define how data is exchanged, including the source of the data, the destination of the data, and how it is transported. These elements include the following:

Local endpoints Transport adapters Channels Actions Endpoints Endpoint action policies Endpoint action data policies Queues Global settings Pipeline settings Value mapping

The transport layer is implemented in Microsoft Dynamics AX through the forms that you use to configure AIF. To implement a document exchange, you must first configure the transport

functionality that ships with Microsoft Dynamics AX for your specific environment and document exchange. For more information about configuring AIF transport elements, see "Configuring and managing AIF" in the Server and Database Administration Help.

Business Logic
The business logic component of document exchange consists of the data, its format, and the business rules that govern the data. This business logic is exposed by two sets of classesthe base classes and the document service classes in the XML Document Framework. Base Classes The AifDocumentService, AxdBase, and AxInternalBase base classes are the foundation of the Microsoft Dynamics AX business logic type hierarchy. They are described as follows:

AifDocumentService - The base class of all document service classes. All document services inherit from this class and provide a layer of abstraction over the AxdBase classes. The document service class operations (create, delete, find, findKeys, read, and update) call methods from this class (createList, deleteList, findList, findKeyList, readList, and updateList). AxdBase The base class of all Axd<Document> classes. All new documents inherit from this class. The AxdBase class enables you to serialize and deserialize XML to and from tables in Microsoft Dynamics AX. The AxdSalesOrder class is an example of a class that inherits from the AxdBase class. The AxdBase class exposes a number of methods that support the ability to create and read XML. The create methods create records in the Microsoft Dynamics AX database from XML. The read methods retrieve data from the database and return it as XML. The read and create methods implement their functionality by calling the AxdBaseRead and AxdBaseCreate classes, respectively.

AxInternalBase This class provides a further level of abstraction for a table and contains functionality such as value substitution and dynamic defaulting. These classes also expose some of the underlying table's functionality such as field and record validation (they call the table validateField and validateWrite methods). The Microsoft Dynamics AX classes that are derived from AxInternalBase typically implement validation, value substitution, and data defaulting.

In AIF document services, the AifDocumentService instance classes expose service operations. When those service operations are called, the request is passed to the AxdBase class. The AxdBase instance classes read and write to database tables by using the AxInternalBase instance classes. For example, to create a sales order, you call the SalesSalesOrderService.create method and pass in a data object that contains one or more sales orders. The SalesSalesOrderService class inherits from AifDocumentService. The create method then calls the AifDocumentService.createList

method. The AifDocumentService.createList method deserializes the parameters, determines which Axd<Document> class to reference, and calls the createList method on the AxdSalesOrder class (which inherits from the AxdBase class). The call to AxdSalesOrder saves the sales order to the database using the Ax<Table> classes (which inherit from the AxInternalBase class) such as AxSalesTable, AxSalesLine, and so on. XML Document Framework The XML Document Framework is comprised of the classes that implement the business logic for individual documents in Microsoft Dynamics AX. These classes expose internal business logic to external systems and are used to create, read, update, and delete data. The XML Document Framework contains the types of classes shown in the following table. Description The service class is the point of contact for external systems and exposes service operations to those systems: create, delete, find, findKeys, read and update. These classes provide a layer of abstraction from the Axd<Document> classes, and a Service class service class exists for each Axd<Document> class. The service class inherits from the AifDocumentService class, which in turn accesses the AxdBase class. This is how a service class is linked to an Axd<Document> class. The class that represents the entire Document object document and is the root data object. A data object class is created for each data source in the query. These objects are a tree that follows the hierarchy of the query data sources. For example, Data objects SalesSalesOrder_SalesLine is a child of SalesSalesOrder_SalesTable and so on. These objects are children of the root data object class. AOT service An entry in the AOT Services Class Type Example

SalesSalesOrderService

SalesSalesOrder

SalesSalesOrder_SalesTable, SalesSalesOrder_SalesLine, SalesSalesOrder_DocuRefHeader, SalesSalesOrder_DocuRefLine, SalesSalesOrder_InventDim, SalesSalesOrder_MarkupTransHeader, SalesSalesOrder_MarkupTransLine SalesSalesOrderService

node

node where you can view and modify the properties of the service and its operations. Presents XML data as an electronic document. As a group, these classes provide a layer of abstraction from the complexity of the underlying tables and enable developers to implement business logic and error handling at the document level. Each Axd<Document> class has an associated query and can represent data from multiple tables. The Axd<Document>class can also be used to generate an XML schema Axd<Document> that describes the document based AxdSalesOrder on its associated query. Class These classes eliminate the need for an external system that is exchanging data to be aware of the Microsoft Dynamics AX data model or business rules. Note The Axd<Document> class encapsulates the functionality of a document. The terms "Axd<Document> class" and "document" are therefore often used interchangeably. Inherits from the AxInternalBase class and represents a single table in the AOT. As a group, these classes handle all interaction with the base tables and encapsulate any table-specific business logic. Therefore, the calling application AxSalesTable, AxSalesLine, Ax<Table> Class does not require information about AxInventDim, AxDocuRef, the Microsoft Dynamics AX table AxMarkupTrans structures or database business rules. The Axd<Document>classes always use the Ax<Table> classes to read or write to the underlying tables. Typically, you will find an Ax<Table> class for each data

source in the query. Consume Web Services

Microsoft Dynamics AX 2009 provides the ability to consume Web services from X++ code. Creating a service reference to an external Web service generates a .NET service proxy that enables the service to be available through IntelliSense within X++. The external Web service can be consumed by Microsoft Dynamics AX using the .NET service proxy through CLR interop.

Updating Data With AIF


Dynamics AX 2009 This topic has not yet been rated - Rate this topic This topic describes the different ways that you can update data using Application Integration Framework (AIF). AIF services support updating data so companies can implement data synchronization with systems external to Microsoft Dynamics AX. Each document service that is included with Microsoft Dynamics AX that supports data updates has an update service operation. AIF supports two types of updates:

Full update - All the data submitted to AIF is considered to be the full document and all fields in the database tables will be updated with the fields from the submitted document. If there are fields in the table that are not in the submitted data, those table fields will be cleared according to the rules for the data type of the field. The result of a full update is the same as if you deleted the record and then added it from the submitted data with these exceptions:
o o o

Primary key fields are not changed. Fields that are allowed by the schema but not included in the submitted data are cleared. Fields that are not allowed by the schema and therefore cannot be sent as part of the update message are defaulted if they have defaulting logic but are not affected otherwise.

For more information on full updates, see Walkthrough: Updating Data with AIF (Full Update).

Partial update - Only the fields contained in the submitted message will be updated in the database tables. If there are fields in the table that are not in the submitted data, those

field values will retain their original values (except for fields that are defaulted based on other fields that have been updated). The behavior of the partial update differs based on whether you are running Microsoft Dynamics AX 2009 SP1. For more information, see Update Action Rules in AIF. Update Process

When you update data through AIF, you call the document service update service operation. For example, if you want to update a sales order, you call the SalesSalesOrderService.update service operation. This operation takes two parameters.

_entityKeyList - An XML message that contains one or more entity key values (IDs) for the records to be updated. _salesSalesOrder - An XML message that contains the sales order data that will update the sales order in the database.

Each of these parameters must be valid XML and validate against the document and endpoint schemas. These schemas define the content and structure of the service operation parameters. AIF Schemas

There are various schemas that define what data can be updated as shown in the following table. Schema Document schema Endpoint schema Description Defines all the fields that can participate in a data exchange. Any message that comes into AIF must validate against the document schema. Further restricts the fields that can participate in a data exchange for a particular endpoint. The endpoint schema is defined by the data policy that you set for each endpoint action.

View the Document Schema


The document schema is the full schema and contains the complete structure and content for a message coming into AIF. The messages are passed as parameters to service operations. You can view the document schema for each parameter of the SalesSalesOrderService.update operation by following these steps. 1. On the Setup pane in the Basic module, expand Application Integration Framework and click Services. 2. Select the row for the SalesSalesOrderService service and click Service operations. 3. Select the SalesSalesOrderService.update service operation and then click Parameter schema.

4. Select the _salesSalesOrder parameter and click View schema. In the Schema form, you will see the complete schema for all the elements that can be in the message when you update a sales order. 5. To save the schema as an .xsd file, click Save as. Note You can also view the schema for the _entityKeyList parameter. This is the schema for the XML message that contains the entity keys (IDs) for the sales orders to be updated.

View the Endpoint Schema


The endpoint schema defines for each endpoint which fields can participate in an exchange. The endpoint schema is derived from the data policy for each endpoint action. The data policy specifies which fields are enabled and required for an endpoint action. To view the endpoint schema for the sales order update service operation, follow these steps. 1. On the Setup pane in the Basic module, expand Application Integration Framework and click Endpoints. 2. Select an endpoint and click Action policies. 3. On the Endpoint action policies form, select the SalesSalesOrderService.update service operation and then click Parameter schema. 4. Select the _salesSalesOrder parameter and then click View schema. In the Schema form, you will see the complete schema for all the elements that can be in the message when you update a sales order. Note If you select the Default Endpoint on the Endpoints form and click Action policies, on the Endpoint action policies form, you will see a field that is named Is default policy. If this field is selected, then the endpoint is using the default data policy. This means that the schema for the endpoint is the same as the full document schema.

Update Action

In order to specify an update, the XML message coming into AIF must contain the update action in the header as shown in the following code. This specifies that the sales order service update service operation should be called. The update action is used for both full and partial updates. However, partial updates are signified by attributes. Copy

<?xml version="1.0" encoding="utf-8" ?> <Envelope xmlns="http://schemas.microsoft.com/dynamics/2008/ 01/documents/Message"> <Header> <MessageId></MessageId> <SourceEndpointUser></SourceEndpointUser> <SourceEndpoint></SourceEndpoint> <DestinationEndpoint></DestinationEndpoint> <Action>http://schemas.microsoft.com/dynamics/2008/ 01/services/SalesOrderService/update</Action> <ConversationId></ConversationId> </Header> <Body> </Body> </Envelope>

Walkthrough: Updating Data with AIF (Full Update)


Dynamics AX 2009 This topic has not yet been rated - Rate this topic Application Integration Framework (AIF) enables you to integrate your Microsoft Dynamics AX installation with external systems. This framework supports the ability to create, read, update, and delete data. In this walkthrough, you will update a sales order using the file system transport. This topic describes how to configure AIF as well as how to format the update message correctly. This walkthrough illustrates the following tasks:

Configure a file system transport adapter Create and configure a directory Add a channel Enable the sales order service Set up the AIF batch services Read the sales order Update the sales order

This walkthrough demonstrates a full update. This is also known as a "document-centric" update and one in which all the data being updated is assumed to be in the message. If a field in the message matches a field in the table, the table field is updated with the message value. If there is a field in the table that is not in the message, the table field is cleared according to the rules for the data type of the field.

You can identify a full update in one of two ways: 1. The presence of the update action in the message header and no other update attributes in any of the records. 2. The presence of the update action in the message header and the top record in the submitted data contains the replace action attribute. For more information about full and partial updates, see Update Action Rules in AIF. Prerequisites

To complete this walkthrough, you will need:


Microsoft Dynamics AX A license file that has access to AIF

Configure the File System Transport Adapter

To use the file system as the transport, you must first configure a file system adapter.

To configure the file system adapter


1. Open Microsoft Dynamics AX. 2. On the Setup pane in the Basic module, expand Application Integration Framework and click Transport Adapters. 3. Press CTRL+N and select the AIFFileSystemAdapter from the Adapter class field. There may be a slight delay while Microsoft Dynamics AX scans for adapters. 4. Type a name for the adapter in the Name field. 5. Select Active to make the adapter available for use in a channel. Create and Configure Directories

If you have not already done so, you must create an inbound and an outbound directory. The inbound directory is where the XML files that come into AIF will be put. The outbound directory is where XML files produced by AIF will be put. When the batch jobs are started, AIF will poll the inbound directory for files.

To create and configure a directory


1. In Windows Explorer, create an inbound and an outbound directory. 2. Configure the directories with the appropriate permissions. For more information, see "Configure the file system for AIF" in the Server and Database Administration Help.

Add the Channels

The channels associate the file system adapter with the file system directories that you just created. You must create two channels: one for the outbound directory and one for the inbound directory. For more information, see "Create a channel" in the Server and Database Administration Help.

To add the outbound channel


1. On the Setup pane in the Basic module, expand Application Integration Framework and click Channels. 2. In the Channels form, press CTRL+N to create a new channel. 3. Enter the identification information for the new channel, including a unique identifier in the Channel ID field and a friendly name in the Name field. 4. Select File System Adapter in the Adapter field. 5. Select Active to activate the channel. 6. Select Outbound in the Direction field. 7. In the Address field, select the outbound directory (file folder) that you just created. You can select an existing directory or click Make New Folder to make a new directory.

To add the inbound channel


1. Press CTRL+N to create a new channel. 2. Enter the identification information for the new channel, including a unique identifier in the Channel ID field and a friendly name in the Name field. 3. Select File System Adapter in the Adapter field. 4. Click Active to activate the channel. 5. Select Inbound in the Direction field. 6. In the Address field, select the inbound directory (file folder) that you just created. You can select an existing directory or click Make New Folder to make a new directory. 7. In the response channel field, select the outbound channel that you previously created. The response channel is used to respond back to the source endpoint with verification results or error responses to inbound transfers. This is the channel in which AIF will put the sales order that is requested. Enable the Sales Order Service

In order to enable an exchange using a service, you must first enable the service. For more information, see "Configure services" in the Server and Database Administration Help.

To enable the sales order service

1. On the Setup pane in the Basic module, expand Application Integration Framework and click Services. The first time the form opens, the grid is empty and you must click Refresh to load the services. There may be a delay while the services load. 2. Scroll down to the SalesSalesOrderService and select Enabled. Setup the AIF Batch Services

For AIF to begin sending and receiving documents for adapter-based exchanges, the services that move documents through the queues must be running as batch jobs within Microsoft Dynamics AX. For more information, see "Start and stop the asynchronous AIF services" in the Server and Database Administration Help. Read the Sales Order

The first step in updating a sales order is to read the sales order and return the current sales order data in the table to the client. This is necessary because the update operation uses concurrency control to determine whether the record you are attempting to update has been changed in between the time the record was first read and the time the update is sent into AIF. Concurrency control is implemented by comparing a hash value or by comparing the RecId and RecVersion fields for each record being updated. For more information about concurrency, see Concurrency When Updating Data. To read the sales order, you must place a message specifying the entity key (ID) of the sales order you want to read in the inbound directory. AIF will get this message from the inbound channel and put a message containing the corresponding sales order into the outbound channel.

To read the sales order


1. Create an XML file containing the entity key of the sales order to be updated. The format of this message should look like the following XML example. Notice that the <Field> and <Value> elements contain the name of the table field that contains the SalesId and the value of the SalesId. The <Action> element in the header is the only required header element and specifies the read action. This exchange will use the default endpoint that ships with Microsoft Dynamics AX because there is no source or destination endpoint specified in the message header. When using the default endpoint, there is no source endpoint user specified so AIF will get the user credentials from the file itself. Copy
<?xml version="1.0" encoding="utf-8"?> <Envelope xmlns="http://schemas.microsoft.com/dynamics/2008/ 01/documents/Message"> <Header> <MessageId></MessageId> <SourceEndpointUser></SourceEndpointUser>

<SourceEndpoint></SourceEndpoint> <DestinationEndpoint></DestinationEndpoint> <Action>http://schemas.microsoft.com/dynamics/2008/ 01/services/SalesOrderService/read</Action> <ConversationId></ConversationId> </Header> <Body> <MessageParts xmlns="http://schemas.microsoft.com/dynamics/2008/ 01/documents/Message"> <EntityKeyList xmlns="http://schemas.microsoft.com/dynamics/ 2006/02/documents/EntityKeyList"> <EntityKey xmlns="http://schemas.microsoft.com/dynamics/ 2006/02/documents/EntityKey"> <KeyData> <KeyField> <Field>SalesId</Field> <Value>00016_036</Value> </KeyField> </KeyData> </EntityKey> </EntityKeyList> </MessageParts> </Body> </Envelope>

Note This message is passed as a parameter to the SalesSalesOrderService.update service operation. Therefore, it must validate against the schema for the _entityKeyList parameter. For more information, see Updating Data With AIF.

2. Place the message in the inbound directory. Depending on how often you configure the batch jobs to run, the services will get this request message and then write the requested sales order into the outbound directory. The section Response Sales Order XML at the end of this topic provides an example of what the sales order returned by AIF will look like. Update the Sales Order

Now that you have read the sales order, you can make the necessary changes and send the data back to AIF to update the sales order in the table.

To update the sales order


1. Create an XML file that contains the sales order to be updated. The format of this message should resemble the XML in the section Update Sales Order XML at the end of this topic. The <Action> element in the header is the only required header element and specifies the update action. This exchange will use the default endpoint because there is no source or destination endpoint specified in the message header. Notice that there are

no RecId or RecVersion fields so this update will use the _DocumentHash value for concurrency control. 2. Put the message in the inbound directory. Depending on how often you configure the batch jobs to run, the services will retrieve this request message and then update the sales order in Microsoft Dynamics AX. Response Sales Order XML

The following code is an example of what AIF will return when you request a sales order. Copy
<?xml version="1.0" encoding="utf-8" ?> <Envelope xmlns="http://schemas.microsoft.com/dynamics/2008/ 01/documents/Message"> <Header> <MessageId>{2002A291-8AA4-4405-BC10-383C30376F76}</MessageId> <SourceEndpoint>Default</SourceEndpoint> <DestinationEndpoint>Default</DestinationEndpoint> <Action>http://schemas.microsoft.com/dynamics/ 2008/01/services/SalesOrderService/read</Action> <RequestMessageId>{13A5A1E4-D248-4361-B484-791AE121C952} </RequestMessageId> </Header> <Body> <MessageParts xmlns="http://schemas.microsoft.com/dynamics/ 2008/01/documents/Message"> <SalesOrder xmlns="http://schemas.microsoft.com/dynamics/ 2008/01/documents/SalesOrder"> <DocPurpose>Original</DocPurpose> <SenderId>DAT</SenderId> <SalesTable class="entity"> <_DocumentHash>de321661b44419fc5052246e6274f726 </_DocumentHash> <CaseTagging>No</CaseTagging> <CashDisc>14D1%</CashDisc> <CommissionGroup>CCG-OTH</CommissionGroup> <CovStatus>1</CovStatus> <CreditCardAuthorizationError>No </CreditCardAuthorizationError> <CurrencyCode>EUR</CurrencyCode> <CustAccount>4005</CustAccount> <CustGroup>40</CustGroup> <Deadline>2002-03-31</Deadline> <DeliveryAddress>St. Hallvard vei 1 N-0244 Oslo Norway</DeliveryAddress> <DeliveryCity>Oslo</DeliveryCity> <DeliveryCountryRegionId>NO </DeliveryCountryRegionId <DeliveryDate>2002-03-01</DeliveryDate> <DeliveryDateControlType>None </DeliveryDateControlType> <DeliveryName>Office Supplies Inc.</DeliveryName> <DeliveryStreet>St. Hallvard vei 1</DeliveryStreet>

<DeliveryZipCode>N-0244</DeliveryZipCode> <DlvMode>UPS</DlvMode> <DocumentStatus>None</DocumentStatus> <EInvoiceLineSpec>No</EInvoiceLineSpec> <FreightSlipType>None</FreightSlipType> <GiroType>None</GiroType> <InclTax>No</InclTax> <InterCompanyAllowIndirectCreation>No </InterCompanyAllowIndirectCreation> <InterCompanyAutoCreateOrders>No </InterCompanyAutoCreateOrders> <InterCompanyDirectDelivery>No </InterCompanyDirectDelivery> <InterCompanyDirectDeliveryOrig>No </InterCompanyDirectDeliveryOrig> <InterCompanyOrder>No</InterCompanyOrder> <InvoiceAccount>4005</InvoiceAccount> <ItemTagging>No</ItemTagging> <LanguageId>En-us</LanguageId> <Listcode>IncludeNot</Listcode> <MarkupGroup>FR10</MarkupGroup> <OneTimeCustomer>No</OneTimeCustomer> <PalletTagging>No</PalletTagging> <Payment>M15</Payment> <PaymMode>CHEQUE</PaymMode> <PostingProfile>Gen</PostingProfile> <PurchOrderFormNum /> <RecId>5637144586</RecId> <RecVersion>1</RecVersion> <Reservation>None</Reservation> <ReturnReplacementCreated>No </ReturnReplacementCreated> <ReturnStatus>None</ReturnStatus> <SalesGroup>CSG-OTH</SalesGroup> <SalesId>00016_036</SalesId> <SalesName>Office Supplies Inc.</SalesName> <SalesPoolId>DEF</SalesPoolId> <SalesResponsible>MPO</SalesResponsible> <SalesStatus>Backorder</SalesStatus> <SalesTaker>TJO</SalesTaker> <SalesType>Sales</SalesType> <SettleVoucher>None</SettleVoucher> <ShipCarrierBlindShipment>No </ShipCarrierBlindShipment> <ShipCarrierDlvType>Misc</ShipCarrierDlvType> <ShipCarrierExpeditedShipment>No </ShipCarrierExpeditedShipment> <ShipCarrierFuelSurcharge>No </ShipCarrierFuelSurcharge> <ShipCarrierResidential>No</ShipCarrierResidential> <ShippingDateConfirmed>2002-03-01 </ShippingDateConfirmed> <ShippingDateRequested>2002-03-01 </ShippingDateRequested> <totalBalance>3300.00</totalBalance> <TotalCashDiscount>33.00</TotalCashDiscount> <TotalInvoice>3300.00</TotalInvoice>

<SalesLine class="entity"> <Blocked>No</Blocked> <CaseTagging>No</CaseTagging> <Complete>No</Complete> <ConfirmedDlv>2002-03-01</ConfirmedDlv> <CurrencyCode>EUR</CurrencyCode> <CustAccount>4005</CustAccount> <CustGroup>40</CustGroup> <DeliveryAddress>St. Hallvard vei 1 N-0244 Oslo Norway</DeliveryAddress> <DeliveryCity>Oslo</DeliveryCity> <DeliveryCountryRegionId>NO </DeliveryCountryRegionId> <DeliveryDateControlType>None </DeliveryDateControlType> <DeliveryName>Office Supplies Inc. </DeliveryName> <DeliveryStreet>St. Hallvard vei 1 </DeliveryStreet> <DeliveryType>None</DeliveryType> <DeliveryZipCode>N-0244</DeliveryZipCode> <InventDimId>00001_060</InventDimId> <InventRefType>None</InventRefType> <InventTransId>00065_059</InventTransId> <ItemId>OL-1500</ItemId> <itemReplaced>No</itemReplaced> <ItemTagging>No</ItemTagging> <LineAmount>3300.00</LineAmount> <LineNum>1.0000000000</LineNum> <Name>Office Lamp 1500 2-tubes</Name> <PalletTagging>No</PalletTagging> <PriceUnit>1.00</PriceUnit> <ProjCategoryId>Lamps</ProjCategoryId> <QtyOrdered>200.00</QtyOrdered> <RecId>5637144590</RecId> <RecVersion>1</RecVersion> <RemainInventPhysical>200.00 </RemainInventPhysical> <RemainSalesPhysical>200.00 </RemainSalesPhysical> <Reservation>None</Reservation> <ReturnAllowReservation>No </ReturnAllowReservation> <ReturnStatus>None</ReturnStatus> <SalesGroup>CSG-OTH</SalesGroup> <SalesId>00016_036</SalesId> <SalesPrice>16.50</SalesPrice> <SalesQty>200.00</SalesQty> <SalesStatus>Backorder</SalesStatus> <SalesType>Sales</SalesType> <SalesUnit>Pcs</SalesUnit> <Scrap>No</Scrap> <TaxAutogenerated>Yes</TaxAutogenerated> <TaxItemGroup>full</TaxItemGroup> <InventDim class="entity"> <inventDimId>00001_060</inventDimId> <InventLocationId>GW</InventLocationId>

<InventSiteId>S1</InventSiteId> <RecId>5637144576</RecId> <RecVersion>1</RecVersion> </InventDim> </SalesLine> </SalesTable> </SalesOrder> </MessageParts> </Body> </Envelope>

Update Sales Order XML

The following code is an example of what the XML message should look like when you submit data to update a sales order. Copy
<?xml version="1.0" encoding="utf-8"?> <Envelope xmlns="http://schemas.microsoft.com/dynamics/ 2008/01/documents/Message"> <Header> <MessageId></MessageId> <SourceEndpoint></SourceEndpoint> <DestinationEndpoint></DestinationEndpoint> <Action>http://schemas.microsoft.com/dynamics/ 2008/01/services/SalesOrderService/update</Action> <ConversationId></ConversationId> </Header> <Body> <MessageParts xmlns="http://schemas.microsoft.com/dynamics/ 2008/01/documents/Message"> <EntityKeyList xmlns="http://schemas.microsoft.com/ dynamics/2006/02/documents/EntityKeyList"> <EntityKey xmlns="http://schemas.microsoft.com/ dynamics/2006/02/documents/EntityKey"> <KeyData> <KeyField> <Field>SalesId</Field> <Value>00016_036</Value> </KeyField> </KeyData> </EntityKey> </EntityKeyList> <SalesOrder xmlns="http://schemas.microsoft.com/ dynamics/2008/01/documents/SalesOrder"> <DocPurpose>Original</DocPurpose> <SenderId>dat</SenderId> <SalesTable class="entity"> <_DocumentHash>820acb9d4e266e791f5069edd7bd3d39 </_DocumentHash> <CaseTagging>No</CaseTagging> <CashDisc>14D1%</CashDisc> <CommissionGroup>CCG-OTH</CommissionGroup> <ContactPersonId>00174_002</ContactPersonId> <CreditCardAuthorizationError>No

</CreditCardAuthorizationError> <CurrencyCode>EUR</CurrencyCode> <CustAccount>4005</CustAccount> <CustGroup>40</CustGroup> <Deadline>2002-03-30</Deadline> <DeliveryAddress>St. Hallvard vei 1 N-0244 Oslo Norway</DeliveryAddress> <DeliveryCity>Oslo</DeliveryCity> <DeliveryCountryRegionId>NO </DeliveryCountryRegionId> <DeliveryDate>2002-03-01</DeliveryDate> <DeliveryDateControlType>None </DeliveryDateControlType> <DeliveryName>Office Supplies Inc.</DeliveryName> <DeliveryStreet>St. Hallvard vei 1 </DeliveryStreet> <DeliveryZipCode>N-0244</DeliveryZipCode> <DlvMode>UPS</DlvMode> <DocumentStatus>None</DocumentStatus> <EInvoiceLineSpec>No</EInvoiceLineSpec> <Email>test@test.test</Email> <FreightSlipType>None</FreightSlipType> <GiroType>None</GiroType> <InclTax>No</InclTax> <InterCompanyAllowIndirectCreation>No </InterCompanyAllowIndirectCreation> <InterCompanyAutoCreateOrders>No </InterCompanyAutoCreateOrders> <InterCompanyDirectDelivery>No </InterCompanyDirectDelivery> <InterCompanyDirectDeliveryOrig>No </InterCompanyDirectDeliveryOrig> <InterCompanyOrder>No</InterCompanyOrder> <InvoiceAccount>4005</InvoiceAccount> <ItemTagging>No</ItemTagging> <LanguageId>En-us</LanguageId> <Listcode>IncludeNot</Listcode> <MarkupGroup>FR10</MarkupGroup> <OneTimeCustomer>No</OneTimeCustomer> <PalletTagging>No</PalletTagging> <Payment>M15</Payment> <PaymMode>CHEQUE</PaymMode> <PostingProfile>Gen</PostingProfile> <PurchOrderFormNum>00007_049</PurchOrderFormNum> <Reservation>None</Reservation> <ReturnReplacementCreated>No </ReturnReplacementCreated> <ReturnStatus>None</ReturnStatus> <SalesGroup>CSG-OTH</SalesGroup> <SalesId>00016_036</SalesId> <SalesName>Office Supplies Inc.</SalesName> <SalesPoolId>DEF</SalesPoolId> <SalesResponsible>MPO</SalesResponsible> <SalesStatus>Backorder</SalesStatus> <SalesTaker>TJO</SalesTaker> <SalesType>Sales</SalesType> <SettleVoucher>None</SettleVoucher>

<ShipCarrierBlindShipment>No </ShipCarrierBlindShipment> <ShipCarrierDlvType>Misc</ShipCarrierDlvType> <ShipCarrierExpeditedShipment>No </ShipCarrierExpeditedShipment> <ShipCarrierFuelSurcharge>No </ShipCarrierFuelSurcharge> <ShipCarrierResidential>No </ShipCarrierResidential> <ShippingDateConfirmed>2002-03-01 </ShippingDateConfirmed> <ShippingDateRequested>2002-03-01 </ShippingDateRequested> <totalBalance>3300.00</totalBalance> <TotalCashDiscount>33.00</TotalCashDiscount> <TotalInvoice>3300.00</TotalInvoice> <URL>www.test.test</URL> <SalesLine class="entity"> <Blocked>No</Blocked> <CaseTagging>No</CaseTagging> <Complete>No</Complete> <ConfirmedDlv>2002-03-01</ConfirmedDlv> <CurrencyCode>EUR</CurrencyCode> <CustAccount>4005</CustAccount> <CustGroup>40</CustGroup> <DeliveryAddress>St. Hallvard vei 1 N-0244 Oslo NO</DeliveryAddress> <DeliveryCity>Oslo</DeliveryCity> <DeliveryCountryRegionId>NO </DeliveryCountryRegionId> <DeliveryDateControlType>None </DeliveryDateControlType> <DeliveryName>Office Supplies Inc.</DeliveryName> <DeliveryStreet>St. Hallvard vei 1 </DeliveryStreet> <DeliveryType>None</DeliveryType> <DeliveryZipCode>N-0244</DeliveryZipCode> <InventDimId>00001_060</InventDimId> <InventRefType>None</InventRefType> <ItemId>OL-1500</ItemId> <itemReplaced>No</itemReplaced> <ItemTagging>No</ItemTagging> <LineAmount>3300.00</LineAmount> <LineNum>1.0000000000</LineNum> <Name>Office Lamp 1500 2-tubes</Name> <PalletTagging>No</PalletTagging> <PriceUnit>1.00</PriceUnit> <ProjCategoryId>Lamps</ProjCategoryId> <QtyOrdered>200.00</QtyOrdered> <RecId>5637144590</RecId> <RecVersion>406348234</RecVersion> <RemainInventPhysical>200.00 </RemainInventPhysical> <RemainSalesPhysical>200.00</RemainSalesPhysical> <Reservation>None</Reservation> <ReturnAllowReservation>No </ReturnAllowReservation>

<ReturnStatus>None</ReturnStatus> <SalesGroup>CSG-OTH</SalesGroup> <SalesId>00016_036</SalesId> <SalesQty>200.00</SalesQty> <SalesStatus>Backorder</SalesStatus> <SalesType>Sales</SalesType> <SalesUnit>Pcs</SalesUnit> <Scrap>No</Scrap> <ShipCarrierDlvType>Misc</ShipCarrierDlvType> <ShippingDateConfirmed>2002-03-01 </ShippingDateConfirmed> <ShippingDateRequested>2002-03-01 </ShippingDateRequested> <StatTriangularDeal>No</StatTriangularDeal> <TaxAutogenerated>Yes</TaxAutogenerated> <TaxItemGroup>full</TaxItemGroup> <InventDim class="entity"> <inventDimId>00001_060</inventDimId> <InventLocationId>GW</InventLocationId> <InventSiteId>S1</InventSiteId> <RecId>5637144576</RecId> <RecVersion>1</RecVersion> </InventDim> </SalesLine> </SalesTable> </SalesOrder> </MessageParts> </Body> </Envelope>

Next Steps

After you submit the message to update the sales order, you can check the status of the exchange in the Queue manager form. After AIF has processed the message, you can view it in the Document history form or troubleshoot any errors in the Exceptions form. For more information, see "Managing document exchanges" in the Server and Database Administration Help.

Concurrency When Updating Data


Dynamics AX 2009 This topic has not yet been rated - Rate this topic This topic describes how you can implement concurrency when updating data in Microsoft Dynamics AX by using Application Integration Framework (AIF). Concurrency is the ability for multiple processes to access or change shared data at the same time. The greater the number of concurrent processes that can execute without blocking each other, the greater the concurrency of the database system. When you update data in Microsoft Dynamics AX using AIF, there are two methods the framework uses to handle concurrency:

The document hash The RecId and RecVersion fields for each record in the update

When performing an update, you must first read the data, modify it, and then send it back to update the database. Document Hash

When you update data using AIF, the document hash is required and it must be correct. If the document hash is not in the message or if it is incorrect, AIF will return an error. When you read data, AIF returns a document hash field called _DocumentHash. This field contains a hash of all the RecId and RecVersion values for each record that is returned. When you send the data back into AIF to update a record, it recalculates the document hash from the database records in the update and compares it to the document hash in the inbound message. If the data has changed, for example, if a record was updated or added, the calculated document hash will differ from the document hash in the inbound document and AIF will return an error. If a concurrency error occurs when AIF checks the document hash, AIF can only report that a record was changed and not which record changed. RecId and RecVersion

The RecId and RecVersion fields are optional for concurrency checking. If these fields exist in a message, AIF will use them for concurrency checking in addition to the document hash. If the RecId and RecVersion fields are included in a message, then they must be correct otherwise AIF will return an error. If these fields are not included, then AIF will use only the document hash for concurrency. If the inbound message contains the RecId and RecVersion field values for each record, AIF will check those values against the values in the database table before data is updated. If the RecId and RecVersion field values in the inbound message differ from the values in the table, a concurrency error is returned. When you use the RecId and RecVersion fields for concurrency and an error occurs, the error will specify the table and record in which the data has changed.

2012

What's New: Services and AIF for Developers in Microsoft Dynamics AX 2012 [AX 2012]

This topic has not yet been rated - Rate this topic Updated: January 10, 2013 Applies To: Microsoft Dynamics AX 2012 R2, Microsoft Dynamics AX 2012 Feature Pack, Microsoft Dynamics AX 2012 This page lists the new and enhanced developer features for Services and Application Integration Framework (AIF) that are available in Microsoft Dynamics AX 2012. For more information about administrator features, see What's New: Services and AIF administration. Services and AIF both support integration with external systems. Services is the WS-* standardsbased programming model that enables you to expose Microsoft Dynamics AX functionality through service interfaces. AIF is the framework that contains integration-specific features such as integration ports, data policies, pipelines, transforms, and so on. For information about new features included in Microsoft Dynamics AX 2012 R2, see What's New in Microsoft Dynamics AX 2012 R2 for Developers. What is new or changed?

This feature has changed considerably since Microsoft Dynamics AX 2009. Many new features have been added to support application development and integration with Microsoft Dynamics AX through services. New features have been added to enable X++ business logic to be exposed as services and for X++ to consume services. In addition to programming model changes, AIF has been updated to enable developers to create transformations of non-XML data. The AIF system services enable you to retrieve user or metadata information and also to run queries.

Services Enhancements Service Groups Support for Data Model Changes Business Operation Framework Support for Non-XML Files SOAP Headers Consume External Services in X++ Correlate Exceptions, Ports, and Messages in the Exception Log System Services Support for New Document Service Operations GetKeys and GetChangedKeys

Services Enhancements
What can you do? Microsoft Microsoft Dynamics Dynamics AX 2009 AX 2012 Why is this important? Where can I find more

information? Enables you to easily expose X++ business X++ classes had to X++ classes and logic as a service to implement a service members can be external systems. Using Custom interface in order to exposed as services This means that Services be exposed as a and service operations existing X++ code service. by using attributes. investments can be re-used. Any .NET or X++ native type (such as a Enables you to more Only classes that str or an int) can be easily develop Services implemented the used as a data services because you Using Data support data AifSerializable contract. Any class can use all native Contracts in contracts of interface could be that uses the AIF data types and complex X++ any type. used as service data contract attributes can types as data contracts. be used as a data contracts. contract. Data contracts can Support for complex Support for now use X++ X++ types means that Using Data X++ types Feature not container types and more complex data Contracts in in data available. strongly typed X++ scenarios can X++ contracts. collections such as a supported in services. Set or an Array. X++ business logic can easily be exposed as a service.

Service Groups
What can you do? Microsoft Microsoft Dynamics Dynamics AX 2012 AX 2009 Why is this important? Where can I find more information?

You only have to add a reference to a single WSDL to A service group is a gain access to the service collection of services proxies for all the services in The ability that are frequently that service group. Service to group Services consumed and groups enable type sharing for services by were Services, managed together. simple types common across using managed at service All services in a various services in a service service the operations, and service group are group. For example, if two groups was individual service groups published in a single services in a service group take added to the service level. Web Services a parameter that is an enum or AOT. Definition Language Extended Data Type (EDT), it (WSDL) file. is shared and can be seamlessly passed between the two services. Complex types

like Address, however, are not shared.

Support for Data Model Changes


What can you do? Microsoft Dynamics AX 2009 Microsoft Dynamics AX 2012 The document services framework supports the data model changes implemented in Microsoft Dynamics AX 2012. The document services framework handles the following scenarios to produce a usable data contract schema:

Why is this important?

Where can I find more information?

Extensive data model Feature not changes are available. supported by AIF.

Replaces a surrogate foreign key (SFK) with the natural key for a specific table relationship. This means that the service contract has user-friendly, readable fields instead of AIF fully obscure SFKs. supports data Handles all queries that model features contain the Global to make data Address Book (GAB) contracts easier views as one of their data to use. sources. Supports query data source tables that implement table inheritance. Supports query data sources that contain tables with date effective fields. Handles query data sources that contain tables with dimension columns. The framework supports serialization and deserialization of the dimension columns across the service boundary. The wizards used to create

What's New: AOS and Database for Developers in Microsoft Dynamics AX 2012

and update document services support these data model changes.

Business Operation Framework


What can you do? Microsoft Dynamics AX 2009 Only the RunBase framework was available. User interface, business logic code, and data contract code were all contained in a single class. Microsoft Dynamics AX 2012 Why is this important? Where can I find more information?

Business Operation Framework (BOF) replaces the RunBase framework.

You can use BOF to write applications that have BOF uses services reduced client to server to call from the communication. Because client to the server BOF uses services, there is so application no calling from the client SysOperation chattiness is back to the server, and an Framework reduced. The BOF open connection from the Overview classes separate the server to the client cannot be user interface, maintained. The user business logic, and interface for input data contract logic. parameters can be autogenerated.

Support for Non-XML Files


Microsoft What can Dynamics you do? AX 2009 Microsoft Dynamics AX 2012 Why is this important? Where can I find more information?

Data that is not XML, for example, a comma-delimited file, can now be imported into and exported from Microsoft AIF Dynamics AX. This feature supports provides the ability for developers the import Feature not to create custom transformations and export available. that are used to transform nonof data in XML data into a format that can non-XML be consumed by AIF. Custom formats. transformations can be implemented by using an XSLT or a .NET DLL that implements the ITransform interface.

AIF can work with non-XML data, and Messages and you can handle all transforms in data transformations AIF within Microsoft Dynamics AX

SOAP Headers

Microsoft What can Dynamics AX Microsoft Dynamics AX 2012 you do? 2009 SOAP headers have been extended. Now there is a strongly-typed parameter that is part of the service contract.

Why is this important?

Where can I find more information?

You can add SOAP headers when you call a service to pass additional data into the service. The following SOAP headers Extended SOAP You can are supported: Developers headers enable pass data had to developers to into a manually add Company The calling provide more service by custom code users default company. contextual using the for SOAP Language The calling information to a SOAP headers. users default language. service when the header. Logon As User This is client calls it. the Microsoft Dynamics AX user who performs the service operation. Defaults to the submitting user (calling user) in the format domain\user.

Using the Call Context

Consume External Services in X++


What can Microsoft Dynamics you do? AX 2009 Consume external web services from X++ without adding a service reference in the AOT. You could consume an external Web service from X++, but you first had to add a service reference in the AOT. The ability to consume external services only worked in limited scenarios. For example, server authentication was not supported. Microsoft Dynamics AX 2012 The Service References node has been removed from the AOT. You add a service reference in a .NET project and then add that project to the model store. Then you can access the external service Why is this important? Where can I find more information?

There is now full support for web services that have complex schemas in addition to support for web services Consuming authentication. The External Web comprehensive Services deployment functionality in Visual Studio means that your service references are automatically deployed

from X++ code.

when you configure them to do so.

Correlate Exceptions, Ports, and Messages in the Exception Log


Microsoft Where can I find What can you Microsoft Dynamics Why is this important? more do? Dynamics AX 2012 AX 2009 information? Configure You can view You can Troubleshooting troubleshooting information about correlate integrations is easier options for Feature not the related port, exceptions to because you can correlate integration ports available. message, and messages and the exception to the message set on the ports. related port and message. Monitoring Exceptions form. services and AIF

System Services
Microsoft What can you Why is this Dynamics Microsoft Dynamics AX 2012 do? important? AX 2009 System services are Windows Communication Foundation (WCF) services that are included with Microsoft Dynamics AX. The system services include the following: The system services open up Microsoft Dynamics AX Metadata service development to other Enables you to query Use system platforms because for data about the services to they enable you to structure of your interact with Feature not retrieve system installation. You can and retrieve available. information via retrieve metadata for Microsoft labels, menus, tables, services. System Dynamics AX services make it data types, enums, information. services, and so on. The easier to develop metadata service should applications that be used when you want work with Microsoft Dynamics AX. to return information about the structures in Microsoft Dynamics AX to a client application. Query service Enables Where can I find more information?

AIF System Services

you to issue a query for data without using an 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 that the query is run in one of three different ways: static query, userdefined query, or dynamic query. User session service Enables you to retrieve information about the calling user such as the users default language, default company, default company time zone, and so on.

Support for New Document Service Operations GetKeys and GetChangedKeys Microsoft What can you Dynamics do? AX 2009 Why is this important? Change tracking is supported for data exchanges. Retrieving a list of entity keys for only those records that have changed since the last refresh improves performance when you update data external to Microsoft Dynamics AX. Where can I find more information?

Microsoft Dynamics AX 2012

The following two new service You can operations are supported: implement change GetKeys returns a list of tracking by entity keys for documents retrieving only based on a document entity keys for Feature filter. those records not GetChangedKeys that match available. returns a list of entity keys certain criteria for documents based on and that have criteria in a document changed since filter. It also restricts the a specified list to include only keys date and time. for records that have

Configuring AIF for change tracking

changed since a specified date and time. Are there any special considerations?

AIF integrations in Microsoft Dynamics AX 2009 are upgraded to Microsoft Dynamics AX 2012 during the installation process. However, there are some manual upgrade actions that you may have to perform. The following points should be considered for any upgrade.

The Microsoft Dynamics AX data upgrade process attempts a conversion of all AIF artifacts that correspond to artifacts in Microsoft Dynamics AX 2012. For example: the conversion of endpoints to integration ports. However, some artifacts cannot be upgraded because there is no equivalence in Microsoft Dynamics AX 2012, for example, endpoint constraints. After the upgrade is complete, you should verify the configuration of your integration ports and properties. There is no code upgrade for services code. All existing services must be manually updated with the required SysEntryPointAttribute and other access-level attributes so that they are deployed successfully.

Using the Application Integration Framework (AIF) to integrate Microsoft Dynamics AX with external software systems
Dynamics AX 4.0 8 out of 9 rated this helpful - Rate this topic

Application Integration Framework (AIF) provides an extensible framework that supports multiple asynchronous transports, as well as synchronous transport using Web services, to reliably exchange documents in XML format with trading partners or other systems. An exchange starts with a document, that is, a document class defined using Microsoft Dynamics AX business logic. The document is serialized into XML and header information is added to create a message, which may then be transferred into or out of your Microsoft Dynamics AX system (called the local endpoint within AIF). The other entity taking part in the exchanges is called the endpoint. The transaction types are called actions in AIF: for example, SendPurchaseOrder. You set up and configure endpoints and actions and all the other elements of an exchange using forms found when you click Basic > Setup > Application Integration Framework.

An asynchronous exchange uses an adapter to convert the document into the proper format for exchange by means of a particular transport mechanism, such as Microsoft Message Queuing (also known as MSMQ). Adapter-based exchanges are asynchronous in that they involve moving the document into a queue where it waits for processing by a Microsoft Dynamics AX batch job. Adapter-based exchanges require configuration of a channel for use by the AIF. Adapters support the following transaction types for asynchronous exchange:

Send Documents - Microsoft Dynamics AX sends documents to another system Receive and Create Documents - Microsoft Dynamics AX receives documents from another authorized system and creates new records in the Microsoft Dynamics AX database Respond to Read and Query Requests - Microsoft Dynamics AX receives requests for documents from another authorized system, retrieves the requested information (whether a document or a list of documents) from the Microsoft Dynamics AX database, and returns it to the requesting system, with appropriate filtering and security

The same transactions can be accomplished by using Web services. Using Web services for inbound documents requires installation and configuration of Web services for application integration and Microsoft Internet Information Services (IIS) 6.0. An exchange using outbound Web services (that is, sending a document from your installation to another system) requires an adapter and the Web services that reside on the receiving end of the transaction. You configure the AIF framework using the configuration forms found in the Basic section of Microsoft Dynamics AX. For asynchronous, adapter-based exchanges, you configure and control the Microsoft Dynamics AX batch jobs that process documents in the AIF queues. Exchanges configured to use inbound Web services are processed synchronously. AIF allows multiple connections. That is, your Microsoft Dynamics AX system can support the processing of document exchanges with multiple partners using multiple transport types simultaneously. Microsoft Dynamics AX includes the functionality to enable connections with the following asynchronous adapters:

Microsoft Message Queue (MSMQ)


Important

To send documents using MSMQ, you must use a domain account for the AOS account. For more information, see Install an Application Object Server (AOS) instance

File system (documents exchanged to and from folders on a computer) Outbound Web Services

Synchronous document exchange is supported using inbound Web services.

To help ensure the highest level of security, deploy Web services on your intranet only. Deployment of Web services outside your intranet requires additional middleware to ensure security.
Send and receive documents and data

By using outbound exchanges in AIF, you can send documents and data to your trading partners. You receive documents and data from endpoints in an inbound exchange.

Send documents and data


Sending a document can be initiated by clicking a button on a form, such as the Send electronically button on the Chart of accounts form. For more information, see How to send and receive documents electronically and About sending and receiving documents electronically.

Receive documents and data


When documents are received in an inbound transfer data is added, deleted or changed in the Microsoft Dynamics AX database. For this reason, you should carefully consider how to proceed to help ensure the security of your Microsoft Dynamics AX system when configuring the Microsoft Dynamics AX users associated with an endpoint, making sure that the users are trusted by your business organization.
Create a connection

Whether you exchange documents using Web services or an adapter-based exchange such as MSMQ, file system, or outbound Web services, you must:

Negotiate agreements on document or data exchange with trading partners or third parties which are represented in the Microsoft Dynamics AX database. Install Web services for application integration using the Microsoft Dynamics AX setup program and install and configure Microsoft IIS 6.0 if you intend to set up exchanges that use inbound Web services. See Install an application integration server and Configure IIS to work with Microsoft Dynamics AX Web services. Configure the connection using the forms found when you click Basic > Setup > Application Integration Framework. You use a different set of steps when you configure asynchronous adapter-based exchanges (including outbound Web services) and synchronous exchanges using inbound Web services. For more detailed information about configuration, see the sections on configuring, below. See also Configuring document exchanges.

Carefully consider the resources used in the transfer and the effect of the transfers on performance. You can set the maximum batch size (or set it to be unlimited) to control the number of messages processed from a queue at one time by a batch job. You can also set the maximum locking interval, that is, the maximum time in minutes that the channels and endpoints are to be locked while processing. If you do not have any special circumstances, such as very large or very small messages, you can use the default, monitor your system's performance, and change the maximum locking interval accordingly. Maintain and troubleshoot connections by viewing messages in the queues and information when exceptions occur using the Queue manager, Document history, and Exceptions forms found by clicking Basic > Periodic > Application Integration Framework. See Managing document exchanges.

Configure an adapter-based (asynchronous) exchange

A core installation of Microsoft Dynamics AX includes the software to enable adapter-based connections. After a connection is configured and processing initiated by starting the Microsoft Dynamics AX batch jobs, messages are exchanged between the local endpoint and the endpoint using the defined channel. The XML messages consist of the document and a header and can be viewed during the exchange as they appear on the queues. After your company decides to exchange documents or data with a trading partner or third-party system, you must perform the following tasks.

Configure the local endpoint (your Microsoft Dynamics AX system). A local endpoint also determines the company that inbound messages are applied to. See Create and configure local endpoints. Create and configure actions that define the transactions processed though the framework. Every action specifies a Microsoft Dynamics AX document and the direction of the transfer. For example, the SendPurchaseOrder action specifies that the Microsoft Dynamics AX Purchase Order document is to be sent to the endpoint. See Configure an action. Choose a transport mechanism (MSMQ, file system, or outbound Web services) and perform any prerequisite configuration. See the following topics: o Configure Message Queuing to work with Microsoft Dynamics AX. o Configure Microsoft Dynamics AX to use the file system for exchanging documents. o Configure outbound Web services. Configure the adapter and enable it for use in a channel. Adapters are custom software components that pass the document to a specific transport mechanism, for example, MSMQ. See Configure an adapter. Create and configure a channel, specifying the adapter. Channels define the transport method and address, which enables messages to move in and out of the framework to reach the endpoint. See Configure a channel.

Define an endpoint for the trading partner or third party, which must be represented in the Microsoft Dynamics AX database. An endpoint is the destination for an outbound document and the source of an incoming document. See Configure an endpoint.
Note

Endpoints are the conceptual entities at either end of a transaction. For example, a single endpoint may apply to multiple customers or vendors. If sales order confirmations must be sent to a chain of retail stores where each store is set up in the Microsoft Dynamics AX database as a separate customer, you can create a single endpoint which can be authorized for each of the individual stores.

Create endpoint action policies to define the actions (an action contains a document and an operation, for example SendPurchaseOrder) to be associated with an endpoint. See Configure endpoint action policies. Create a data policy for each action on each endpoint. The data policy determines which of the document's data fields participate in the exchange. See Configure endpoint action data policies. Optionally, define a pipeline to perform any optional document transformations, value substitutions, or custom operations. See Configure a pipeline. Optional value mappings are available for certain documents as well.
Note

The pipeline is a configurable engine for processing XML documents as they enter or are sent from Microsoft Dynamics AX. The pipeline is composed of a series of individual pipeline components that are executed in sequential order to transform the XML document. Some generic pipeline components are provided with the Microsoft Dynamics AX installation. The architecture of the pipeline allows developers to create and configure new pipeline components.

Start and stop processing in the queues for adapter-based exchanges by setting up batch jobs to process the asynchronous channels (using forms found by clicking Basic > Setup > Batch). For more information, see Processing batch jobs and Start and stop the asynchronous Application Integration Framework (AIF) services.

Configure an exchange using Web services

The AIF also provides a Web services interface for exchanging documents synchronously. This interface provides a seamless integration experience for Microsoft .NET and other Web clients. The Web services are generated automatically from the Microsoft Dynamics AX business logic, so that developers with limited Web experience can easily create their own Web services. After your company decides to exchange documents or data with a trading partner or third-party system using Web services, the following tasks must be performed.

Install Web services for application integration. See Install an application integration server.

Configure IIS for Web services. This includes specifying the folder where Web services will be installed using the Microsoft Dynamics AX setup wizard, using IIS and Windows administrative tools to set up the Application Pool, to configure security settings, and to create the virtual directory for Web services. See Configure IIS to work with Microsoft Dynamics AX Web services.

Create a record for the Web site and enter its virtual directory share path using the Web sites form from a Microsoft Dynamics AX client. See Configure Web sites for document exchange.

Configure the local endpoint (your Microsoft Dynamics AX system). A local endpoint also determines the company that inbound messages are applied to. See Create and configure local endpoints.

Create and configure actions that are used to generate Web services. Every action specifies a Microsoft Dynamics AX document and the direction of the transfer. For example, the SendPurchaseOrder action specifies that the Microsoft Dynamics AX Purchase Order document is to be sent to the endpoint. See Configure an action.

Generate Web services for the actions. See Create Web services for an action.

Define an endpoint for the trading partner or third party, which must be represented in the Microsoft Dynamics AX database. An endpoint is the destination for an outbound document and the source of an incoming document. See Configure an endpoint.

Note

Endpoints are the conceptual entities at either end of a transaction. For example, a single endpoint may apply to multiple customers or vendors. If sales order confirmations must be sent to a chain of retail stores where each store is set up in the Microsoft Dynamics AX database as a separate customer, you can create a single endpoint which can be authorized for each of the individual stores.

Create endpoint action policies to define the actions (an action contains a document and an operation, for example SendPurchaseOrder) to be associated with an endpoint. See Configure endpoint action policies.

Create a data policy for each action on each endpoint. The data policy determines which of the document's data fields participate in the exchange. See Configure endpoint action data policies.

Optionally, define a pipeline to perform any optional document transformations, value substitutions, or custom operations. See Configure a pipeline. Optional value mappings are available for certain documents as well.
Note

The pipeline is a configurable engine for processing XML documents as they enter or are sent from Microsoft Dynamics AX. The pipeline is composed of a series of individual pipeline components that are executed in order to transform the XML document. Some generic pipeline components are provided with the Microsoft Dynamics AX installation. The architecture of the pipeline allows developers to create and configure new pipeline components.

Perform optional configuration: document transformations, value substitution, and value mapping

The pipeline is a configurable engine for processing XML documents as they enter or are sent from Microsoft Dynamics AX. The pipeline is composed of a series of individual pipeline components that are executed in order to transform the XML document. Some generic pipeline

components are provided with the Microsoft Dynamics AX installation. The architecture of the pipeline allows developers to create and configure new pipeline components.

With value lookups, you can substitute one character string for another in any field of a document. You can configure value lookups using the AifValueSubstitutor pipeline component. See Creating and configuring a pipeline. You can also create value lookups for any field, if you know the data type for the field. After creating a value lookup table using the Value lookup form, you associate that value lookup table to the pipeline component by entering an identification number in the Lookup table ID field when you configure the pipeline component. You can set up optional pre-defined value mapping that is available for certain documents on the Value Mapping form. The value mappings are pre-defined for each document, and arise from the associated business logic. You can map the values used for the active action policy and for the particular endpoint such as item number, customer account number, vendor account number and terms of delivery.

Maintain integration with external software systems

Maintaining integration includes the following tasks:

Checking error logs and message queues to monitor traffic. See About the error log and queue management.

Stopping and restarting the framework when necessary. See Start and stop the asynchronous Application Integration Framework (AIF) services.

Reconfiguring the channel and endpoint if conditions change. See Managing changes in documents.

See Also

Setting up and configuring an application integration server Configuring document exchanges Configuring document exchanges with adapters Configuring document exchanges that expose Web services

Use AIF to integrate with external systems


Other Versions

1 out of 2 rated this helpful - Rate this topic

Application Integration Framework (AIF) provides an extensible framework that supports multiple asynchronous transports, as well as synchronous transport using Web services, to exchange documents in XML format with external systems. An exchange starts with a service based on a document, that is, a document class defined using Microsoft Dynamics AX business logic. The document is serialized into XML and header information is added to create a message, which may then be transferred into or out of the Microsoft Dynamics AX system. Your Microsoft Dynamics AX system is called the local endpoint within AIF. The other entity taking part in an exchange is called the endpoint. Endpoints and all the other elements of an exchange are set up and configured using forms found when you click Basic > Setup > Application Integration Framework. There are two methods for exchanging data in AIF:

Web services - A data exchange in which a Microsoft Dynamics AX service is consumed an external system. Adapters - A data exchange in which Microsoft Dynamics AX adapters are used to communicate with the external system. Microsoft Dynamics AX adapters support the following transport mechanisms: o File system o Message Queuing (MSMQ) o BizTalk Server

Web services-based exchanges

Using Web services for data exchange requires the installation and configuration of Web services for application integration and Microsoft Internet Information Services (IIS) 7.0. Exchanges configured to use Web services are processed synchronously and do not use the Microsoft Dynamics AX queues. AIF allows multiple connections; that is, your Microsoft Dynamics AX system can support the processing of document exchanges with multiple partners simultaneously.

To help ensure the highest level of security, deploy Web services on your intranet only. Deployment of Web services outside your intranet requires additional middleware known as a trusted intermediary to ensure security. For more information about AIF security, see Security considerations for AIF and Security considerations for AIF Web services. For more information about data exchanges using Web services, see Web services-based exchanges in AIF and Configure document exchanges with Web services in AIF.
Adapter-based exchanges

An adapter-based exchange uses an adapter to convert the document into the proper format for exchange by means of a particular transport mechanism, such as Message Queuing (MSMQ). Adapter-based exchanges are asynchronous because they involve moving the document into a queue where it waits for processing by a Microsoft Dynamics AX batch job. Adapter-based exchanges require configuration of an adapter and a channel for use by AIF. For asynchronous, adapter-based exchanges, you configure and control the Microsoft Dynamics AX batch jobs that process documents in the AIF queues. Microsoft Dynamics AX includes the functionality to enable connections with the following asynchronous adapters:

File system Message Queuing (MSMQ) BizTalk Server


Note

Although adapter-based exchanges are asynchronous, if you use the BizTalk adapter, it is possible to configure the data exchange to be synchronous or asynchronous.

For more information about data exchanges using adapters, see Adapter-based exchanges in AIF and Configure document exchanges with adapters in AIF.
Send and receive documents and data

Regardless of which transport method you use, AIF can be used to either send data into Microsoft Dynamics AX (inbound) or retrieve it (outbound). An example of an inbound exchange would be an external system sending a sales order to be saved to the Microsoft

Dynamics AX database. An example of an outbound exchange would be an external system sending a request for a purchase order and receiving the purchase order back. The inbound and outbound exchanges can be categorized as follows:

Send data - Microsoft Dynamics AX sends documents to an external system. Send data in response to requests - Microsoft Dynamics AX receives requests for documents from another authorized system, retrieves the requested information (a document or a list of documents) from the Microsoft Dynamics AX database, and returns it to the requesting system, with appropriate filtering and security. The request message would contain the entity keys or a query that specifies the data that the external system is requesting. Receive and create data - Microsoft Dynamics AX receives documents from another authorized system and creates new records in the Microsoft Dynamics AX database.

By using outbound exchanges in AIF, you can send documents and data to your trading partners. You receive documents and data from endpoints in an inbound exchange.

Send documents and data


Sending a document can be initiated by clicking a button on a form, such as the Send electronically button on the Chart of accounts form. For more information, see topics "How to: Send and receive electronic documents automatically" and "How to: Send documents manually" in the Application and Business Processes Help.

Receive documents and data


When documents are received in an inbound transfer, data is added, updated, deleted or changed in the Microsoft Dynamics AX database. For this reason, you should carefully consider how to ensure the security of your Microsoft Dynamics AX system when configuring the Microsoft Dynamics AX users associated with an endpoint. Be sure that endpoint users are trusted by your business organization.

Potrebbero piacerti anche