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

Finally In Seattle For PASS Conference

We all got into Seattle, Wa last night however it got real tuff for me the last 30 minutes until we landed at SeaTac Airport. I started getting real dizzy and almost to the point of passing out. Now the crew mentioned that it happens all the time, however this was new and very scary for me. After a couple of cold napkins on the neck and some OJ, I started feeling better. If anyone has experienced this please let me know. The only thing I could figure was the 5 hour flight and sitting in the middle seat without really stretching. Anyways, I made it safe and getting ready for my presentation on Hacking Sql Server.

Be the first to rate this post

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

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

Dynamics AX Integration

I am currently on a team working on interfacing Dynamics AX with our current "Line of Business". One of the big challenges was how to get data into Dynamics from the outside and have reliability through messaging queues. If you caught my earlier post about Sql Servers Forgotten Technology, Service Broker  was something that we were researching and honestly it is proving its self as we work closer and learn more about what it can do. Now we can effectively get data out of Dynamics to update other systems using Service Broker, but again to get data in was still a challenge.

Dynamics backend is SQL and at first glance it seems that it could be queried and changed just like any other Sql Server backend, but there are fields and relationships that you might not be made aware of. Also, after doing some research, we realized that the Business Connector  that comes with Dynamics was the interface of choice for getting data to Dynamics. Still the question was, "how?" and still have real time updates like we do using Service Broker to get data out. Our model was simple, for the two endpoints call stored procedures that would send messages between the two databases and by the way, this is why we are using Service Broker. It is extremely light for doing this type of functionality. The problem was calling the Business Connector from the DAX side once messages started piling in the queues. I could have had another process running that processed the queues but I wanted to try and keep the same model. Immediately my answer was a CLR Stored Procedure  that could call the managed Business Connector. At least I thought it was totally managed as an interop dll. Something I learned was it was not and it could not be added into SQL's CLR. I saw some articles of how to do it with web services; however I knew that I could probably use WCF as well. After reading a couple of articles I was able to implement it.

Currently rated 1.5 by 2 people

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

Posted by: BayerWhite
Posted on: 11/7/2008 at 1:23 AM
Actions: E-mail | Kick it! | DZone it! | del.icio.us
Post Information: Permalink | Comments (13) | Post RSSRSS comment feed

JaxDUG Has A New President Too

Just the day after elections for President of The United States, our local developer’s user group had their election too. I was running against my good friend Adam Lowe, and after talking one meeting we decided to run together with him as my VP, so as of last Wednesday I am the new President of JaxDUG.

My vision is clear...I want to build back up the energy that JaxDUG had when I first joined it. My passion is technology and I hope to share it by sharing knowledge and building new technology community leaders. Before JaxDUG, I had never spoken to anyone as a group. In fact, some may have heard my story about me taking Speech in college. My professor told me that he would pass me, however he recommended that I steer away from public speaking. Well here I am speaking at Code Camps, User Groups, and major technology conferences and I owe it all to JaxDUG

Currently rated 5.0 by 1 people

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

Posted by: BayerWhite
Posted on: 11/7/2008 at 1:05 AM
Actions: E-mail | Kick it! | DZone it! | del.icio.us
Post Information: Permalink | Comments (0) | Post RSSRSS comment feed