Wednesday, 3 October 2018

BizTalk 2016 and Dynamic eConnect 2013 Adapter

Intro
In this post I'll tell you about our experiences using BizTalk 2016 and the Dynamics eConnect 2013 Adapter together. But to save you reading the entire article I can tell you straight away, this combination seems to work perfectly well with no obvious issues.

So, here's the environment:

BizTalk:
Windows Server 2016 64 bit running BizTalk Server Enterprise 2016 64 bit with Feature Pack 2

BizTalk SQL Server:
Windows Server 2016 64 bit running SQL Server 2016 Enterprise

Microsoft Dynamics GP:
Windows Server 2012 running Dynamics GP 2013

Microsoft Dynamics GP SQL Sever:
Windows Server 2012 running SQL Server 2012


Approach:
eConnect has a few pre-requisites such as MSXML4.0 and Dexterity Shared Runtime. We installed these using the 64 bit installer where possible. When installing eConnect, install the 64 version as the 32 bit version will not work on a 64 bit server. Add your adapter within BizTalk Administration Console and restart your host instances.

We have also created several smaller development and test servers including 32 bit only versions. Following this approach substituting 32 bit with 64 bit during installation works perfectly well too.


Scenarios:
We are using eConnect to integrate POP and SOP transactions which work well and successfully handle failed instances if eConnect encounters GP validation issues. Resuming after such issues also works well.


Caveats:
We have encountered a few minor configuration "teething" issues with this configuration. My next blog post will deal with these in detail.


BizTalk 2016 64bit and Dynamics GP eConnect 2016 64bit

Intro
As promised in an earlier post, there is a bit of a quirk to using the eConnect 2013 adapter in 64 bit mode.

Symptoms
You are using a BizTalk 2016 64 bit server and have installed the eConnect 2013 adapter 64 bit mode to the C:\Program Files\Microsoft Dynamics folder structure. You try to use the adapter to send a message to GP but receive the following exception:

The Messaging Engine failed to create the transport adapter "Dynamics GP eConnect".
  OutboundAssemblyPath: "C:\Program Files (x86)\Microsoft Dynamics\eConnect 12.0\Objects\DotNet\Microsoft.Dynamics.GP.eConnect.BizTalk.Adapter.dll"
  OutboundTypeName: "Microsoft.Dynamics.GP.eConnect.Biztalk.Transmitter"
  Exception Details: "Could not load file or assembly 'file:///C:\Program Files (x86)\Microsoft Dynamics\eConnect 12.0\Objects\DotNet\Microsoft.Dynamics.GP.eConnect.BizTalk.Adapter.dll' or one of its dependencies. An attempt was made to load a program with an incorrect format."



Cause
The key to this is the part of the exception which states "Could not load file or assembly 'file:///C:\Program Files (x86)\Microsoft Dynamics\eConnect 12.0\Objects\DotNet\Microsoft.Dynamics.GP.eConnect.BizTalk.Adapter.dll'" as this isn't where we installed the adapter.

There are two issues here. First, how do you tell BizTalk it's looking in the wrong folder? Second...

Hey! that DLL does exist in C:\Program Files (x86)\Microsoft Dynamics! Oh, and in C:\Program Files\Microsoft Dynamics as well! 

It seems the 64 bit eConnect installer writes into both folders and presumably installs the 64 bit version in one and the 32 bit in the other. It then tries to use the 32 bit version from the 64 bit host instance and chokes.

Workaround
After some hacking through BizTalk and eConnect documentation and configuration it seems it's not easy to tell BizTalk which folder to look in. However it appears using the DLLs in C:\Program Files (x86)\Microsoft Dynamics is a viable option. In our case we simply created a dedicated host instance for 32 bit adapters and then configured the eConnect adapter to use this instance instead.

One point of note. After doing this and then restarting the host instances you will be unable to resume the suspended message instances. They will throw the following exception:

A message sent to adapter "BiztalkMessagingEngine" on send port "Post Outbound eConnectSalesInvoice Message to GP FNL" with URI "data source=GPDatabase;initial catalog=FNL;integrated security=SSPI;persist security info=False;packet size=4096" is suspended.
 Error details: Unknown Error Description
 MessageId:  {DD3BC94A-6FC6-4B77-8871-3898DAB2CA89}
 InstanceID: {50177942-B210-4BA0-AF27-323B8430B6E5}

While this exception looks unfriendly at first it is actually quite informative. The adpater called "BizTalkMessageEngine" is actually a kind of wrapper for all other adapters. What it's saying here is that the underlying adapter has failed and has not been able to send any exception details back.

Or, to put it another way, resuming the eConnect message using an adapter that has been entirely reconfigured to use a different processor architecture using different DLLs has been a fraction promlematic. Fair enough I guess. Terminate the message instances. The ones from this point on will work fine.

BizTalk 2016 64 Bit and SQL Adapter

Intro
In this post I'll tell you about our experiences using BizTalk 2016 64 bit and the standard SQL adapter together. It's not exactly rocket science but hopefully it may save a few people a few minutes.

So, here's the environment:

BizTalk:
Windows Server 2016 64 bit running BizTalk Server Enterprise 2016 64 bit with Feature Pack 2

BizTalk SQL Server:
Windows Server 2016 64 bit running SQL Server 2016 Enterprise

BizTalk Host Instances:
One 64 bit In-Process host


Scenario:
We are using the SQL adapter packaged with BizTalk Server to receive data from our SQL server using a stored procedure. When executing the query we receive the following error:

The receive location "Receive Blah" with URL "SQL://blahserver/blahdb/blahquery" is shutting down. Details:"The receive adapter on this receive location is not supported on 64-bit host instances. Please make sure that the receive adapter is associated with a 32-bit only handler. ".


Fix:
This is one of the few occassions when BizTalk gives you an exception which is short, explicit and gives you all the information you need. Simply create an extra host in BizTalk Administration Console which has the 32 bit checkbox checked. Add the host instance to go with it. Then go into the Adapers section and look at the properties of the SQL adapter. Change the default host to your new 32 bit host and then restart both host instances. Your adapter will now work perfectly.