最新消息:ww12345678 的部落格重装上线,希望大家继续支持。

AX 2012: Create AIF document service

网络文摘 William 564浏览 0评论

Purpose:

The purpose of this document is to illustrate how we can develop AIF document service, what are the important methods available that can be overridden to do the customization and finally how we can consume/unit test the document service through an external .NET application.

Business requirement:

Ability to integrate Dynamics AX with external systems.

Assumptions:

Application Integration Framework (AIF) has been configured to process inbound and outbound messages.

Development:

  • Create an AOT query. Prefix it with Axd to follow the naming convention for document service.
  • Run AIF document service wizard to generate/regenerate:
    • Service node
    • Service class
    • Document class (Axd class).
    • Document object class
    • Data object classes
    • AxBC classes, if chosen
  • Change namespace property of service node (optional).
  • Generate incremental CIL.
  • Register the service
  • Create security privilege for each service operation (optional).
  • Create an enhanced inbound port
  • Choose an adapter
    • File system adapter
    • HTTP
    • ISABEL SEPA credit transfer
    • MSMQ
    • NetTcp
    • Windows Azure Service Bus
  • Choose service operations
  • Activate

Important methods:

  • Axd class
    • prepareForSave/prepareForSaveExtended method
      • Validation code goes here. For example checkPurchParmTable in II7
    • updateNow method
      • Business logic to be executed post insert/update of document. For example, post receipt in II7.
    • expandSurrogateForeignKeys method
      • To automatically resolve the surrogate foreign keys to natural keys, so that user sees natural key in the XML instead of RecId.
    • getSurrogateForeignKeyValue method
      • To manually resolve the surrogate foreign keys to natural keys.
  • AxBC class
    • initMandatoryFieldsExemptionList method
      • To make a field optional which is mandatory at the table level.
    • initMandatoryFieldsMap method
      • To make a field mandatory which is optional at the table level.
    • set<FieldName> method
      • To set default value of a field in service. This method calls parm<FieldName> method to set the default value.

Consuming service:

  • Create console application in Visual Studio
  • Add service reference
  • Sometimes, setting some fields doesn’t work in C#. We use specified parm methods for them. For example:
    • Course.Name = “Name”;
    • Course.NameSpecified = true;
    • Course.Description = “Desc”;
    • Course.DescriptionSpecified = true;

发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址