Nintex workflow with custom web services

This article will explain how you can use custom web service in a Nintex Workflow.

Web services are very common method of communicating between two systems, SharePoint and Nintex also contains several Web service methods.
In this article we will use a custom web service, a simple Web service that converts temperature from Fahrenheit to Celsius and vice versa.
You can create this web service via this MSDN article.
Yes, we could use other and better methods for converting temperatures but this is just used as a simple introduction to web services.

The List
In this example the list will contain the following fields:

  • Title, standard field
  • Temperature, number field
  • Measurement, choice field (Celsius or Fahrenheit)
  • Result, number field

Create Workflow

The workflow will convert a manual entered temperature to Fahrenheit or Celsius and update the item.
Drag the following actions on the canvas:

  • Set a condition
  • Call Web service (left)
  • Query XML (left)
  • Call Web service (right)
  • Query XML (right)
  • Regular expression
  • Set field value

Custom Web Service

Variables

The following variable need to be created

  • ResultWebService, single line of text

 

Set a condition action

This action will check if the user measurement field is Celsius or Fahrenheit. If Celsius then we go right and convert Fahrenheit to Celsius, otherwise we go left and do the opposite.

Web service action

Open the web service action to the left to configure.
In the URL field add the full URL to the web service, if a username and password are required enter this and click on the Refresh button.
Select from the pull down field Web method the option CelsiusToFahrenheit.
Fill the field Celsius (double) with the Item Property Temperature.
Store result in the variable ResultWebService

Custom Web Service

Before closing the action first test the web service. Click on the Button Run Now

 

Replace the text {ItemProperty:Temperature} with a value, in our example we use 12 and click on Execute. Select and copy the Results section. Click on Close and Save the action.

Custom Web Service

Query XML Action

Open the query XML action and configure as followed.
XML source is XML, XML is the ResultWebService variable
Output 1 Process using is XPath
Click on the XPath Builder button
Remove all data and paste the result from the web service in this screen

Custom Web Service 

Click on Tree View and select the final step CelciusToFahrenheitResult. Click on Apply

 

Store the outcome in ResultWebService.

 

 

Regular expression action

As the web service returned the result with a point and we require a punctuation mark we use a regular expression action to convert the result.
Pattern is \.
Replacement text is ,
Input text is our trusty variable the ResultWebService
Store result in, again that good friend the variable ResultWebService

Set field value

Final step is to write the result back to the item. Open the set field value and configure.
Set Field Result Equals Workflow Data ResultWebService.
Save and Publish the workflow.

Run the workflow

When the workflow is executed the web service calculates the degrees and writes this in the result part of the item.

Findings

During trainings people ask me how you know what actions you need to use in a workflow, and it’s often that when developing the workflow you discover the actions that you need. In this workflow I directly knew that I needed a Call web service action and a Set field value, then when configuring the web service action you find out that you need two web service actions for the different conversions. This results in an extra set a condition action and the workflow grows.


If you liked this article be sure to have a look at Nintex Workflow User's Guide for more tips, tricks and hands-on assignments.

 

 

 

1 comment

  • Barry

    This looks great!

    Barry Saturday, 07 February 2015 12:37 Comment Link

Leave a comment

Make sure you enter all the required information, indicated by an asterisk (*). HTML code is not allowed.

NINTEX TRAINING

BleiCon can provide standard or customized Nintex trainings from end-user to administrators.

Discover what Nintex training fits your organisation

CONTACT

BleiCon
Meulenspie 21
4847 TK Teteringen

PARTNERS

BleiCon is Microsoft Certified Partner

CERTIFIED

Bleicon is Nintex Workflow Pro certified

We use cookies on our website. Some of them are essential for the operation of the site, while others help us to improve this site and the user experience (tracking cookies). You can decide for yourself whether you want to allow cookies or not. Please note that if you reject them, you may not be able to use all the functionalities of the site.

Ok