Microsoft Dynamics AX 2009 Integration and Development with .NET Framework Application Integration Framework Agenda • Common Integration Scenarios and Options • What is Application Integration Framework (AIF) • Enabling Microsoft Dynamics AX as a Service Platform • AIF Service Model – Programming Model – Service Deployment – WCF Services • Service Lifecycle: Compose, Expose, Consume Common Integration Scenarios Integration Scenarious and Options • Application to application (A2A) integration – Synchronize data between applications • Business to business (B2B) integration – Implement automated business processes between trading partners Business Process: Orders-to-Cash Purchase Requisition Sales Order ASN Purchase Invoice Customer Picking List Packing Slip Sales Invoice Light Company Warehouse Management System Price List Microsoft Dynamics AX Customer Application Price/Discount Agreement Integration Scenarios Customer Batch Files System Light Company Customer Internet Vendor AX XML Web Services Web Services BAPI Vendor System Application SAP Integration Technologies Microsoft Dynamics AX Trading Partners Third-Party Systems BizTalk Server 2006 XML XML XML Direct X++ API Calls Web Services CLR Interop .NET Business Connector AOS Microsoft Dynamics AX Asynchronous Transports AIF What is Application Integration Framework What Is AIF • Application Integration Framework (AIF) is the infrastructure within Microsoft Dynamics AX to exchange data with other systems • AIF enables B2B and A2A integration • Data is exchanged using XML documents • AIF has adapter-based and Web service types of exchange AIF Exchange Types There are two methods for exchanging data in AIF: • Web services - a data exchange in which a MSDAX service is called by an external system. • Adapters - a data exchange in which MSDAX adapters are used to communicate with the external system. MSDAX adapters support the following transport mechanisms: – File system – Microsoft Message Queuing (MSMQ) – BizTalk Server Basic AIF Concepts Expose Consume DB Local Endpoint AIF WS Axd<Document> Service Operations Adapter Endpoints 11010110011 Web Service Client AIF Services Async AOS Microsoft Dynamics AX Channels XML Document Enabling Microsoft Dynamics AX as a Service Platform Services Platform Enable Microsoft Dynamics AX for Service Oriented Architecture (SOA) Framework for creating and managing services Support for document and custom services Data exchange in form of XML documents Configurable transport infrastructure Extensible X++ framework Flexible architecture How Does AIF Enable SOA? • Readily available business logic – Service contract – Service implementation – Data types and schemas • Tools and Programming model – Compose services – Exposing services – Consuming services • Platform – Value added components – Various transports – Communication infrastructure Windows Communication Foundation (WCF) • • • • Designed for building service-oriented apps WCF is the interface for service communication Uses config file to specify service interface Provides the following features: – – – – – – – Unified programming model Integration to Microsoft Visual Studio Interoperability with other platforms Attribute-based programming WS-* protocol support Extensibility location transparency Message-oriented programming WCF: Address, Binding & Contract A Service Endpoint has an Address, a Binding, and a Contract (ABC) • Address - indicates where the service is located • Binding - specifies how a client can communicate with the endpoint including transport protocol, encoding, and security requirements • Contract - identifies what operations are available to the clients Client C B A A B C A B C A B C Service Address Binding Contract Where? How? What? Endpoint AIF Service Model AIF in Microsoft Dynamics AX 2009 • Create and Expose AIF services: – New programming model – Update and Delete functionality • Consume external web services: – Web references • WCF based Services Infrastructure • Target: Internet Facing Services AIF Service Model • AIF Service consists of: – Service contract – Service implementation – Data types • AIF Service flavors – AIF services • Generic service type • Arbitrary service operations and data types – Entity services • Services based on Queries • Typically CRUD+ functionality Programming Model • Define service contract – Write an X++ interface • Implement service – Write an X++ class that implements the contract • Implement data types – Write the X++ classes used as parameters in the Service contract – Provide custom serialization • Use AIF Services – From within the Microsoft Dynamics AX application – Published as WCF Services WCF Services • Key Features – Design time • Implement AIF services as reusable X++ classes • Publish (X++) AIF services as WCF services • Client programming experience, WS Addressing, Standards (WSSecurity, WS-Reliable Messaging, etc.); .NET 3.0, Perl, Java, etc. – Configuration time • Leverage rich set of WCF configuration parameters • Extend functionality through behaviors, custom bindings, etc. • Separate infrastructure configuration from application configuration – Runtime • Benefit from .NET Framework 3.0 runtime • Standardized, consistent external interface • Make business functionality and data available to other applications in the enterprise network and to trading partners Service Lifecycle: Compose, Expose, Consume Compose AIF Services • Prerequisites: – Developer license • General steps: – – – – Define contract Implement contract Compile artifacts Register service • Use Service Wizard to: – – – – – – Create a query Configure the query Generate service Customize service Build service Register service Generate AIF Service Axd<Document> query defines Axd<Document> XML structure and content class performs serialization and SalesTable deserialization XML SalesLine ... ... DB Ax<Table> classes manage data access XML Schema Structure <?xml version="1.0" encoding="utf-16"?> <SalesOrder xmlns="http://schemas.microsoft.com/dynamics/"> <DocPurpose>Original</DocPurpose> <SenderId>dmo</SenderId> Empty Hidden <SalesTable class="entity"> <CaseTagging>No</CaseTagging> <CovStatus>1</CovStatus> <CurrencyCode>EUR</CurrencyCode> <CustAccount>4020</CustAccount> <SalesLine class="entity"> <Blocked>No</Blocked> <CaseTagging>No</CaseTagging> <Complete>No</Complete> <CurrencyCode>EUR</CurrencyCode> ... <InventDim class="entity">…</InventDim> </SalesLine> <DocuRefHeader class="entity">…</DocuRefHeader> <DocuRefHeader class="entity">…</DocuRefHeader> </SalesTable> </SalesOrder> Generate WCF Service • The service generation framework is responsible for creating: – WCF Service contracts and operation contracts from X++ interface/classes – Types and Schemas for parameters and return types. – WCF Configuration file Service Deployment (WCF) • Prerequisites – Set up host (for example, IIS6, IIS7) – Configure service deployment in Microsoft Dynamics AX client • Publish AIF Service as WCF Service – – – – Generate managed code Generate WCF configuration file Deploy WCF service artifacts (for example, to IIS) Perform advanced WCF configuration, if needed Consume External Web Services • • • • Consume any Intranet/internet services Generate client side proxy using WCF Configure client side with standard WCF configuration files Provide rich developer experience: – – – Easy to add web reference. Similar to VS CLR Interop and Intellisense support in X++ Support to work with strongly typed classes referencing services AIF Services is Key Advantage • AIF is best practices for accessing AX data from external systems and some MorphX scenarios Demo Compose Web Service Expose AIF Service • Prerequisites: – Service is ready for use • Steps: – – – – Configure transport Configure external components (if applicable) Configure security (if necessary) Publish service Demo Expose Web Service Consume Web Service • Prerequisites: – Get access to the Web service definition (WSDL) • Steps: 1. 2. 3. 4. 5. Create Web reference Build Web reference Write application code Compile application code Use the external service as part of the business process Demo Consume Web Service Q&A Introducing the Lab • In this lab you will: – Create a new AIF service and all the needed X++ artifacts with the help of AIF service wizard – Extend this service with custom service operations – Consume the AIF service from the .NET application © 2008 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.