Exposing Dynamics AX Business Connector Through WCF

I finally met my objective last week of connecting with Dynamics through it's available Business Connector and wanted to share some code. If you read my last post on Dynamics AX Integration, Dynamics comes with a Business Connector that exposes code written in Dynamics syntax X++ through a .Net Interop DLL. Because of how it is managed through .Net I could not expose it through the SQL CLR and had to choose another way. WCF was a better choice because now it could be exposed as a service to other LOB applications within our organization. The hardest thing to note was how to handle the "dynamic" parameters that are exposed through the Business Connector's methods. For example, methods like createPackingSlipHeader(STR PURCH_ID, STR PACKSLIP_ID, [DATE TRANS_DATE]) are exposed through the connector like this

FBFPurchReceiptInterface.Call("createPackingSlipHeader", parmsPO.ToArray(typeof(object)));

Therefore each parameter to the method gets past through an object array. To make things even more difficult, you can't just instantiate the array initially with the number of parameters to pass, and if one is not required just pass 'null'. This logic just does not work. Instead try using the ArrayList. The below code will show you how I use two methods exposed through the connector to build a purchase order with multiple line items. The lines commented is how I experimented with nulls.

Currently rated 2.0 by 1 people

  • Currently 2/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Posted by: BayerWhite
Posted on: 11/17/2008 at 5:27 PM
Actions: E-mail | Kick it! | DZone it! | del.icio.us
Post Information: Permalink | Comments (181) | Post RSSRSS comment feed

Comments

Comments are closed