Aif BizTalk

Introduction
When performing updates with BizTalk and the AIF framework, an empty XML message without any "message parts" is returned when an update was successful. Because the return message does not contain any "message parts" or elements, BizTalk throws an exception.

Error messages
When using a XMLReceive pipeline in BizTalk you might get a message in the Event Viewer similar to the following:

A response message sent to adapter "Microsoft Dynamics AX 2009" on Receive Location: "Sync.Dynamics AX 2009" with URI:"ax5://localhost:2712" is suspended. Error details: There was a failure executing the response(receive) pipeline: "Microsoft.BizTalk.DefaultPipelines.XMLReceive, Microsoft.BizTalk.DefaultPipelines, Version=3.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" Source: "XML disassembler" Send Port: "Sync.Dynamics AX 2009" URI: "ax5://localhost:2712" Reason: The body part is NULL.

When using a PassThrough pipeline in BizTalk you might get a message in the Event Viewer similar to the following:

xlang/s engine event log entry: Uncaught exception (see the 'inner exception' below) has suspended an instance of service 'Company.Vendors.Orchestrations.Update_VendTable(2dac4b28-09c9-7366-b634-eca462cdda6f)'. The service instance will remain suspended until administratively resumed or terminated. If resumed the instance will continue from its last persisted state and may re-throw the same unexpected exception. InstanceId: 8011d079-57af-4a60-85f1-05bb068f4212 Shape name: ShapeId: Exception thrown from: segment -1, progress -1 Inner exception: Received unexpected message type 'DynamicsAx5.VoidMessage' does not match expected type 'Company.Vendors.Orchestrations.VendTableService_update_Response'.

Exception type: UnexpectedMessageTypeException Source: Microsoft.XLANGs.Engine

Work around
To work around this, the serialize method of the AifMessageParts class can be modified to return a simple XML message. Add the following before the "xmlTextWriter.writeEndElement;" statement in the serialize method of the AifMessageParts class:

if (partCount == 0) {                                                                          xmlTextWriter.writeRaw('\n\nZERO\n\n'); }