Introduction

  • This solution shows how you can integrate a BizTalk Server 2013 application with the Microsoft Dynamics CRM Online 2016 using the WCF-Custom adapter with Custom Behavior to exchange messages with external systems in a reliable, flexible, and scalable manner.
  • Microsoft does not provide an adapter for Microsoft Dynamics CRM 2011- 2016 and the integration can only be realized via an original WCF service.
  • BizTalk will communicate to Dynamics CRM for all types of operations like below using Organization Service.
  • Create
  • Update
  • Delete
  • Execute
  • Associate
  • Disassociate
  • Retrieve
  • RetrieveMultiple

Description

  • In my recent project, I got a scenario where we need to establish a connection to Microsoft Dynamics CRM Online through BizTalk Server 2013 R2.
  • But when I started with this, there is no helpful information related to CRM Connectivity or Adapters or Connections related to BizTalk.
  • BizTalk server should invoke all the WCF methods exposed by CRM Online 2016 Organization Service.
  • The solution uses the following elements to realize the integration between the two products : WCF-Custom adapter using wsHttpBinding with custom Endpoint Behavior to communicate to CRM Online system.

Building the Sample

  • Follow the below-detailed steps to Run the below sample.
  • To download the sample BizTalk Application, WCF Behavior MSDN Code Samples
  • Zip File Includes: CS files, BizTalk Port Bindings, Sample Retrieve Multiple Request, Response files and CRM Online 2016 Organization Service WDSL.

WCF Behavior Code Map at Glance

  • Code Map.
WCF Behavior Code Map at Glance

Fig 0 - Assembly Code Map

Detailed Steps to configure and to run the sample

  • Open, Extract & Build the Solution.
  • Install the below assembly’s using command prompt as Administrator
BizTalk.CRMOnline.WCF.Behavior.dll
Ex: Gacutil -i "AssemblyName.dll"
Fig 1 – Assembly Installation
Fig1 – Assembly Installation
  • The following section configurations need to be added to the machine.config

Configuration Path: "C:\Windows\Microsoft.NET\Framework\v4.0.30319\Config\machine.config" "C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Config\machine.config"

<system.serviceModel>
  <extensions>
    <behaviorExtensions>
      <add name="BizTalkCRMOnlineBehavior" type="BizTalk.CRMOnline.WCF.Behavior.CRMExtensionElement, BizTalk.CRMOnline.WCF.Behavior, Version=1.0.0.0, Culture=neutral, PublicKeyToken=06c1c6bf55c19e69"/>
    </behaviorExtensions>
  </extensions>
</system.serviceModel>
  • The Sample Endpoint Behavior takes four parameters like described below.
  • <ms-xrm:AppliesTo>urn:crmapac:dynamics.com</ms-xrm:AppliesTo>
Tbl-1 WCF Behavior Fields
Tbl-1 WCF Behavior Fields
  • Import the binding file from the folder you extracted the solutions.
- Once you import the binding file successfully looks like below configurations in the send ports.

                - Clear the text, update the details as shown below with your CRM Online Details.

                                    OR
    Remove existing Endpoint Behavior, reconfigure the behavior with all the required details.

- Update the Folder Paths with your local folders (Receive, Send).

Fig 2 – Behavior mandatory Field Configurations
Fig 2 – Behavior mandatory Field Configurations
Fig 3 – Behavior Selection
Fig 3 – Behavior Selection
  • CRM Online records view for all Contacts, Accounts entity.
Fig 4 – CRM Contacts Entity Records
Fig 4 – CRM Contacts Entity Records
Fig 5 – CRM Account Entity Records
Fig 5 – CRM Account Entity Records
  • Testing BizTalk application Behavior Sample for sample Retrieve Multiple Request

    - Drop the sample files from the below folder

    File:    BizTalk.Request.Contact.RetrieveMultiple.xml   BizTalk.Request.Account.RetrieveMultiple.xml

    Path:  C:\MSDN\BizTalk.CRMOnline.Connectivity\Testing.Location\IN   C:\MSDN\BizTalk.CRMOnline.Connectivity\Testing.Location\OUT

Fig 6 – BizTalk Fetch Expression Contact Request
Fig 6 – BizTalk Fetch Expression Contact Request
Fig 7 – BizTalk Fetch Expression Account Request

Fig 7 – BizTalk Fetch Expression Account Request
  • Check the output folder for the CRM response.
Fig 8 – BizTalk Request Response Files
Fig 8 – BizTalk Request Response Files
Fig 9 – CRM Contact Entity Fetch Expression Response in XML Format
Fig 9 – CRM Contact Entity Fetch Expression Response in XML Format
Fig 10 – CRM Account Entity Fetch Expression Response in XML Format
Fig 10 – CRM Account Entity Fetch Expression Response in XML Format

Conclusions

  • This article shows how BizTalk Server will communicate with Microsoft Dynamics CRM Online 2016 using the concepts of WCF Extensibility.

See Also

Return to Top