Charlie Mott

  Home  |   Contact  |   Syndication    |   Login
  20 Posts | 0 Stories | 18 Comments | 0 Trackbacks

News

View Charlie Mott's profile on LinkedIn



Archives

Post Categories

Article Source: http://geekswithblogs.net/charliemott

This article describes our approach to testing BizTalk integration with Dynamics AX 2009.  It builds on the "Alternative Bindings" approach as described by Mike Stephenson.  
 

Alternative Bindings

We are communicating asynchronous with Dynamics.  As such, in our developer / unit test bindings, we have replaced use of the AIF Adapter with the MSMQ Adapter.   If you are communicating synchronously, you could use the WCF Adapter.
 

Mimic the Dynamics AIF Adapter

We also need to mimic the actions of the AIF Adapter.  To do this, we have used 2 test pipelines and a test schema in our developer bindings:
 

  • We created a test implementation of the AX envelope schema (AxEnvelope.xsd).  This has the same namespace and structure as the actual AX schema.  The difference is that our test schema has all the Header fields as promoted properties. 
Test AX Envelope Schema with Promoted Properties
  • On the send side, our send ports use our MimicDynammicsAifAdapterSend pipeline.  This has an XML Assembler component.  This wraps the outbound messages in the AxEnvelope envelope.  With property demotion, the header fields are set from the context properties (as set in our orchestrations). This enables us to test these values in our BizUnit validation steps.
     
  • On the receive side, our MimicDynamicsAifAdapterReceive pipeline has an XML Disassembler that strips off the envelope.  The header fields are prompted to the message context properties.  In particular, the MessageId envelope header field is required to be added to the message context so the response messages can be correlated to the message sent to Dynamics. The dissassember references the schemas: DynamicsAx5.Fault, DynamicsAx5.EntityKeyList, DynamicsAx5.EntityKey and all other message types we are expecting from Dynamics.

Stub Dynamics

In order to mimic Dynamics sending a response to messages we send to Dynamics, we also built a custom BizUnit test step (AxSendResponseStep). 

The response message can be a valid response (DynamicsAx5.EntityKeyList) or an invalid response (DynamicsAx5.Fault) as specified in the step parameters.  In the Dynamics response message, the MessageId is replaced with the same MessageId in the received message.  This ensures the Dynamics response messages can be correlated by BizTalk orchestrations.

Update: 03/04/2011 - This approach only applies to integration with AX4 and AX5.  These versions provide the AIF Adapter.  In AX6 (AX2012), services are exposed as WCF services.  As such, regular approaches to stubbing out WCF services can be used.

posted on Wednesday, May 13, 2009 9:26 AM

Feedback

# re: Stub of Dynamics AX for BizTalk Development and BizUnit Testing 5/14/2009 12:06 PM Mark
Good work Charlie, I think I have seen this approach somewhere else!!!!!!!!

# re: Stub of Dynamics AX for BizTalk Development and BizUnit Testing 9/21/2009 8:02 AM Nick Heppleston
Charlie - I might just be dropping you a line to talk about this method, I may be doing some Dynamics work soon.

Cheers, Nick.

# re: Stub of Dynamics AX for BizTalk Development and BizUnit Testing 10/18/2009 7:51 PM Ryan CrawCour
nice approach! any chance of sharing your sample code for this scenario?

# re: Stub of Dynamics AX for BizTalk Development and BizUnit Testing 2/2/2010 4:16 AM Eirik Alne
I'd also like to see some sample code if that's possible :)

# re: Stub of Dynamics AX for BizTalk Development and BizUnit Testing 9/6/2010 2:24 PM Salam
Nice idea, I would also appreciate if you can share the demo code if possible

# biztalk development 12/6/2011 6:18 PM biztalk developer india blog
After study a few of the blog posts on your website now, and I truly like your way of blogging. I bookmarked it to my bookmark website list and will be checking back soon. Pls check out my web site as well and let me know what you think.

# re: Stub of Dynamics AX for BizTalk Development and BizUnit Testing 1/7/2012 3:27 AM huijian
I might just be dropping you a line to talk about this method,and I truly like your way nike tn of blogging

# re: Stub of Dynamics AX for BizTalk Development and BizUnit Testing 7/8/2014 6:50 PM Akshay
Thanks for the suggesting a way to Test BizTalk-AX Unit Testing.

Post A Comment
Title:
Name:
Email:
Comment:
Verification: