Microsoft Gold Cloud CRM and Gold Cloud Platform Partner

I was recently working on a WCF (Windows Communication Foundation) service to keep InsideView’s most recent data in a SQL database. This database served as a cache when updating accounts in Dynamics CRM Online. I used the cached database as a fail-safe option if the link to InsideView’s API or CRM’s API had ever failed.

My process was to get accounts that had new InsideView data and pull it into the caching database using SSIS (SQL Server Integration Service). From there, I got InsideView’s most recent data either from the cached database if it already existed, or from InsideView’s API if it was a new record that was related to those accounts, and pushed it back to the CRM instance. This was achieved by my WCF service via a function.

Another option would have been to get ALL of the accounts that had InsideViews’ data, have my service grab the InsideView data for each of the records, and push it straight back to the account in CRM. However, this would have resulted in many API calls to both InsideView, and CRM, and would have had less tracking for any errors that occurred. As a result, I came across an issue where I had an SSIS package, and wanted to call my WCF service’s function that did not have a return value.

This tutorial will explain my steps to call the WCF function from SSIS using a script task.

1. Verify the WCF service is running. The services application can be accessed by going to the start menu–>and typing in ‘Services’.




2. In the project solution of the SSIS package, add a package variable that contains the URL of the service. The variables window can be accessed in Visual Studio by clicking View–>Other Windows–>Variables.

If you do not know the WCF URL, it can be found in the configuration file of the WCF service.

3. In the Control Flow, add a Script Task which can be found in the SSIS Toolbox under the ‘Common’ tab.

4. Open the Script Task Editor by double-clicking the Script Task, and add the URL variable created earlier as a ReadOnlyVariables.

5. Click ‘Edit Script…’ to open the script main class, and add the service reference of the running WCF service.

6. In the main class, using the service reference, add the logic to create the binding, endpoint address, channel, and connect to the client. After this, you can call the service function(s) that you’d like, passing in the parameters if need be.

And there you have it, calling a WCF voided function using SSIS as the client.