WCF-SQL adapter, using MSDTC cross domain

Today I had to set up the WCF-SQL adapter, to write data to a database used for BI purposes. We have our BizTalk machine located at a hoster, the BI database is located on a server on-premise at the client, and a VPN connection connects the servers. The servers are in different domains.

Generating the schemas went without problems, however once we wanted to do some actual work on the database we got the following 2 errors in the event log:

MSDTC encountered an error (HR=0x80000171) while attempting to establish a secure connection with system BIBIZ.

And

The adapter failed to transmit message going to send port “Communicate with BI” with URL “mssql://bibiz.acme.nl//bibizDatabase?”. It will be retransmitted after the retry interval specified for this Send Port. Details:”System.Transactions.TransactionManagerCommunicationException: Communication with the underlying transaction manager has failed. —> System.Runtime.InteropServices.COMException: The MSDTC transaction manager was unable to push the transaction to the destination transaction manager due to communication problems. Possible causes are: a firewall is present and it doesn’t have an exception for the MSDTC process, the two machines cannot find each other by their NetBIOS names, or the support for network transactions is not enabled for one of the two transaction managers. (Exception from HRESULT: 0x8004D02A)

It turned out, that to use MSDTC across domains you have to set some options. I will list the actions to be taken here, both for my own reference, and to help anyone else running into this problem. Continue reading

Object reference not set to an instance of an object

Okay, so the scenario is this:
–          Generated schemas from a webservice, this created a request schema, a response schema, and a schema with complex types used in the schemas
–          Two promoted fields in the response message (an error code and description)
–          An orchestration which sends out the request, receives the response, and uses a decide shape to create an email message if the response error code is something other than 0

So after deploying everything, and running a test, the orchestration got suspended with an error message like this:

xlang/s engine event log entry: Uncaught exception (see the ‘inner exception’ below) has suspended an instance of service ‘Acme.BizTalk.System.Orchestrations.ImportProduct(dcfd4fa0-976a-7a77-4aec-0b9cbc3c9200)’.
The service instance will remain suspended until administratively resumed or terminated.
If resumed the instance will continue from its last persisted state and may re-throw the same unexpected exception.
InstanceId: c0a43be3-e729-4315-9da3-15337a92c5a4
Shape name: DecideShape_CheckResult
ShapeId: f8255ab5-a462-4756-b63f-12f463806873
Exception thrown from: segment 1, progress 16
Inner exception: Object reference not set to an instance of an object.

So the problem turned out to be, the distinguished fields don’t get filled, even though the message itself looks just fine. After some digging around I found out the problem was in the Element FormDefault properties, but not just on the response message, but also on the schema which has the complex types defined. On both of these schemas, I had to set the Element FormDefault property to Qualified. After having done a new deployment, everything now works.