Geeks With Blogs
Charlie Mott

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 | Back to top


Comments on this post: Stub of Dynamics AX for BizTalk Development and BizUnit Testing

# re: Stub of Dynamics AX for BizTalk Development and BizUnit Testing
Requesting Gravatar...
Good work Charlie, I think I have seen this approach somewhere else!!!!!!!!
Left by Mark on May 14, 2009 12:06 PM

# re: Stub of Dynamics AX for BizTalk Development and BizUnit Testing
Requesting Gravatar...
Charlie - I might just be dropping you a line to talk about this method, I may be doing some Dynamics work soon.

Cheers, Nick.
Left by Nick Heppleston on Sep 21, 2009 8:02 AM

# re: Stub of Dynamics AX for BizTalk Development and BizUnit Testing
Requesting Gravatar...
nice approach! any chance of sharing your sample code for this scenario?
Left by Ryan CrawCour on Oct 18, 2009 7:51 PM

# re: Stub of Dynamics AX for BizTalk Development and BizUnit Testing
Requesting Gravatar...
I'd also like to see some sample code if that's possible :)
Left by Eirik Alne on Feb 02, 2010 4:16 AM

# re: Stub of Dynamics AX for BizTalk Development and BizUnit Testing
Requesting Gravatar...
Nice idea, I would also appreciate if you can share the demo code if possible
Left by Salam on Sep 06, 2010 2:24 PM

# biztalk development
Requesting Gravatar...
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.
Left by biztalk developer india blog on Dec 06, 2011 6:18 PM

# re: Stub of Dynamics AX for BizTalk Development and BizUnit Testing
Requesting Gravatar...
I might just be dropping you a line to talk about this method,and I truly like your way nike tn of blogging
Left by huijian on Jan 07, 2012 3:27 AM

# re: Stub of Dynamics AX for BizTalk Development and BizUnit Testing
Requesting Gravatar...
Thanks for the suggesting a way to Test BizTalk-AX Unit Testing.
Left by Akshay on Jul 08, 2014 6:50 PM

Your comment:
 (will show your gravatar)


Copyright © charlie.mott | Powered by: GeeksWithBlogs.net | Join free