Integrating With WCF Services

Last Updated: 10/02/2018 Introduced in Version: 3.0

Overview

This tutorial demonstrates how to integrate with a WCF Service in Decisions and use this service in a workflow.

For more information on WCF bindings, please visit https://msdn.microsoft.com/en-us/library/dd936243.aspx

*Note: If your bindings do not show up automatically in the drop down this is because the WCF service you are attempting to use does not publish or expose bindings that Decisions can use automatically. If this is the case, try a standard Web Service Integration or use our SDK.

Example

In this example, integrate with Bing’s Geocode WCF Service and use this integration in a workflow. Begin with creating a Reference to the WCF Service in the Decisions Studio.

Navigate to the project’s designer folder and, at the bottom of the panel, select Datatypes/Integrations > Add WCF Service Reference.

 

 

For this example we will need the URL of the Bing Geocode Service as shown in-browser below:

service

In the Studio, we name our service reference in the Add WCF Service Reference menu (in this example “BingGeocode”), and paste the URL (http://dev.virtualearth.net/webservices/v1/Geocodeservice/Geocodeservice.svc) in the URL field. We should then be able to pick an Endpoint for our service from the drop down menu.

 

Click OK to save our WCF Service Reference.

 

 

 

Decisions Studio creates a WCF service reference in our External Services folder.

 

Next, we are going to use this service in a flow. In the Designer Folder, at the bottom of the panel we click Create Flow.

 

We name it (in this case “Bing GeoCode Service Flow”) and click OK.

 

 

The Flow Designer opens. From the Steps tab on the right, the first step we add is Show Form (in the Favorite Steps category).

 

 

Name the form (in this case “User Inputs Form”) and click Create..

 

 

The Forms Designer opens. We want to design this form to get two user inputs: ZIP Code and Country. To design this form as shown below, add and configure LabelText Box, and Button controls from the Form Controls tab on the right.

When finished, we can save the form and close the Form Designer.

 

 

Back in the Flow Designer, we want to call our Geocode Service. When we created the WCF service reference in the beginning of this example, the Decisions Engine analyzed this new service method and generated new steps for us to use. The new steps are in the Steps tab on the right under Integrations > My Integrations > WCF Services > [WCF Service Reference Name] category.

 

From this location we drag a GeoCode step onto the workspace and connect its Failed outcome path to the red end step. Next we drag a Show Form step onto the workspace and connect the Done outcome.

 

 

We double-click this new form to edit it. We name it (in this case “Results Form”) and click Create to proceed to the Form Designer.

 

We want to design this form to display some of the information the GeoCode service will output based on the inputs provided by the user. From the Form Controls tab on the right, add and configure the form using the highlighted controls. When finished, save and close Forms Designer.

 

Back in the Flow Designer, we connect the Done outcome path from the “Results Form” to the red end step.

Next, double-click the GeoCode step to configure it. Under Inputs, we use Build Data mapping type and click Show Mapping Editor.

 

In the Mapping Editor we drag over the mapping arrows as shown below. We click Build Data for the Address property, click Select Value for Country/Region, and click Select Value of ZIP for PostalCode property. Then, we click Build Data for the Credentials property, use Text Merge.Plain mapping type for Token property and click Show Editor.

 

In the Merge Text Editor we paste our Bing Key and click OK to save and continue.

 

Next, we save and close the Mapping Editor. This completes our Flow. Back in the Flow Designer, to test our flow we click Debug Flow at the top of the panel.

 

In the Debugger, click the play arrow to start the test. The first form (“User Input Form”) opens and we provide inputs for ZIP code and country then click Done.

 

Our second form opens (“Results Form”) and we can see what is returned by the GeoCode service method. Click Done.

 

Our flow executes with no issues.

 

Additional Resources