Monthly Archives: June 2013

BizTalk CRM 2011

BizTalk 2013 to CRM 2011 Integration

I have recently started a project that will use BizTalk 2013 to integrate a number of line of business systems with CRM 2011 and needed to put together a quick proof of concept.

There are plenty of examples out there that involve integrating with CRM 2011 from BizTalk via the SOAP web services. However, BizTalk 2013 now provides the WCF-WebHttp adapter that allows BizTalk to send messages to a REST endpoint so I wanted to explore that option (I don’t want to get into the pros and cons of either approach here, I just wanted to try it out!).

Step 9 in this article provided me with a great starting point and following this got me 95% of the way there. The issue I had was that when it came to posting to the CRM OrganizationData service I was getting the following error:

The adapter failed to transmit message going to send port “SendToCrm” with URL “http://localhost/CrmOrg/XRMServices/2011/OrganizationData.svc/ContactSet/”. It will be retransmitted after the retry interval specified for this Send Port. Details:”System.Net.WebException: There was no endpoint listening at http://localhost/CrmOrg/XRMServices/2011/OrganizationData.svc/ContactSet/ that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details.

Examining the CRM trace logs revealed the following message:

A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 – Could not open a connection to SQL Server)

So there was obviously a permissions issue but I couldn’t put my finger on it. I knocked up a quick console application that posted exactly the same XML as generated by BizTalk to the CRM service and this worked fine. So I knew the problem was with the configuration of the BizTalk WCF-WebHttp adapter and, after some digging around I found an extra step was needed that wasn’t included in the article above:

  1. Open the Send Port Properties and click Configure next to the WCF-WebHttp adapter.
  2. On the Behaviour tab, right click on Endpoint Behaviour and click Add extension.
  3. Add the clientCredentials behaviour.
  4. Expand clientCredentials in the Behaviour view and select Windows.
  5. Set allowedImpersonationLevel to Impersonation.

And that’s it! BizTalk could now successful authenticate with the CRM OrganizationData service and I could see records being created in CRM via BizTalk.

There isn’t much information out there on using the BizTalk 2013 WCF-WebHttp adapter to talk to CRM 2011 at the moment, so hopefully this will save a few people some time.