Microsoft Dynamics 365 Blog

We came across an issue where you are using Microsoft Dynamics AX 2009 Asynchronous BizTalk Adapter to receive response messages from AX 2009. After just having sent an AIF UPDATE or DELETE Action message to AX, the BizTalk Server fails to consume the response message that is generated by AX. The receive location using the AX Adapter is using the default xml receive pipeline, and the “Pass Through” property of the adapter is set to ‘False’

You get the following error logged in the Application Event log on the BizTalk Server:

Source:        BizTalk Server 2006
Event ID:      5740
Task Category: BizTalk Server 2006
Level:         Warning
The adapter “Microsoft Dynamics AX 2009” raised an error message. Details “The message does not contain a body part.”.



You can resolve this issue by installing an AX 2009 Kernel Hotfix, see this blog post for more details.



We were able to workaround the issue so that the response message in the AX AIF Gateway queue does get consumed successfully by the BizTalk Adapter for AX (and hence release the resource channel lock), by implementing the following changes in our BizTalk solution: 

  • We consumed the whole message envelope instead of stripping out the xml envelope. The promoted properties are specified in the header section of the message within the envelope, hence consuming the whole message, will still allow the routing of the message within BizTalk when using the promoted properties.
  • Furthermore since you can only have one receive location communicating to one AOS server, and hence with the following changes to the BizTalk solution meant that you will always have to consume the full message including the envelope and message headers and not be able to just consume the message body:

(1) In the properties of the AX Adapter in the BizTalk receive location, Set the Pass Through property value to ‘True

(2) In the properties of the BizTalk Receive Location using the AX adapter, set the Receive Pipeline to ‘PassThruReceive’ 

(3) Change all the receive shapes in the orchestration that receive messages from AX, such that the Message Type is set to DynamicsAX5.Message.Envelope schema.

(4) Where you are using correlation for the request/response of AX messages, the Correlation Type still needs to be set to DynamicsAx5.RequestMessageId to correlate asynchronous solicit/response messages correctly.

The above steps creates a subscription in BizTalk for where the message type is the DynamicsAX5.Message.Envelope and the BizTalk Adapter for AX consumes the message correctly (In this case it will be the whole message from AX including the envelope). Once the envelope is consumed, it will get routed to the orchestration instance based on the correlation setup on the RequestMessageId property. You can then use xpath statements to extract the message body or whatever data you need from the envelope.

For example, in my sample code to extract the response message I received after a succesful AIF Delete Action I did the following:

In my orchestration in BizTalk my response message gets assigned to a BizTalk Orchestration Message called SalesOrderDeleteResponseMsg. I created two variables called xmlResponseMsg of data type System.Xml.XmlDocument, and strResponse of data type string. I then used the following xpath statement in an Expression shape to extract the xml response message and assign it to xmlResponseMsg and then extract the content from the xml message and assign it to strResponse:

xmlResponseMsg = xpath(SalesOrderDeleteResponseMsg.ReturnValue,”/*[local-name()=’Envelope’ and namespace-uri()=’’]/*[local-name()=’Body’ and namespace-uri()=’’]/*[local-name()=’MessageParts’ and namespace-uri()=’’]”);

strResponse= xmlResponseMsg.OuterXml;

NOTE: You will encounter a similar issue when using the Synchronous Adapter (by using the Solicit-Response port in an orchestration) and a workaround for this is detailed in the white paper: Microsoft Dynamics AX 2009 White Paper: Application Integration Framework (AIF) BizTalk Adapter Configuration for Data Exchange, Part II


–author: Anup Shah
–editor: Anup Shah
–date: 17/Sep/2009
–last edited: 27/Jul/2010

We're always looking for feedback and would like to hear from you. Please head to the Dynamics 365 Community to start a discussion, ask questions, and tell us what you think!