Export and publish a workflow with the Nintex Workflow SOAP Web Service

This topic describes how to use the Nintex Workflow SOAP endpoints to export and publish a workflow.

Nintex Workflow uses the SOAP endpoints that are accessible using a Windows Communication Foundation (WCF) client. Visual Studio allows for the creation of a proxy and client that you can use to interact with these endpoints. You will want to:

Download the WCF Nintex Workflow Sample

This archive contains the source code of the Windows Communication Foundation (WCF) Workflow sample.

Download source code

Export and publish a workflow overview

You can create a SOAP client bound to the endpoint and then interact with the Nintex Workflow resources. The following steps are the high-level steps. Find the details below.

To export and publish a Workflow

  1. Create the console application in Visual Studio
  2. Add the service reference
  3. Add the service dependency
  4. Update app.config
  5. Add variables
  6. Instantiate the SOAP client
  7. Use the endpoints

Create the console application in Visual Studio

You can use Visual Studio to create your application.

To create the console application

  1. Open Visual Studio on your SharePoint server.
  2. Create a console application by selecting File and then New, and then under the Visual C# group, selecting Console Application.
  3. Name your application and solution. Click OK.

Add the service reference

You can use Visual Studio to add the reference to the Nintex Workflow services. Visual Studio will add the code that will enable you to instantiate the SOAP client. Add the service reference to: http://yoursite/_vti_bin/NintexWorkflow/Workflow.asmx.

To add the service reference

  1. Right-click the Services References folder in the Solution Explorer, and select Add Services References.
  2. Add the Nintex Workflow SOAP service end point to the Address box. It is: http://yoursite/_vti_bin/NintexWorkflow/Workflow.asmx and click Go.
  3. Click OK. The Service under the service namespace will be added to the Service Reference folder.

Add the service dependency

You will need to add the service dependency to your class.

To add the service dependency

  1. Right-click the service reference, and then select View in Object Browser.
  2. Select the namespace and name of the service references and add to the dependencies section of the Program.cs file in the console application:
using WorkflowWCFExport.ServiceReference1;

Update app.config

Update the configuration file (app.config) to set your binding settings. The binding contains parameters specified as attributes of the binding element. In addition in the security group, you will need to specify the mode as TransportCredentialOnly. When you instantiate the SOAP client, you will specify the name of the binding. For instance in this example the following specifies the NintexWorkflowWSSoap binding indicated by the attribute name in the binding element:

NintexWorkflowWSSoapClient soapClient = new NintexWorkflowWSSoapClient("NintexWorkflowWSSoap")

To update app.config

  1. Add the binding selection (below) into the basicHttpBinding element.
  2. Note the name of your binding.

Binding Section


<binding name="NintexWorkflowWSSoap" closeTimeout="00:01:00" openTimeout="00:01:00" 
receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false" 
bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" 
maxBufferSize="100000000" maxBufferPoolSize="100000000" 
maxReceivedMessageSize="100000000" messageEncoding="Text" textEncoding="utf-8" 
transferMode="Buffered" useDefaultWebProxy="true">
<readerQuotas maxDepth="32" maxStringContentLength="999999999" maxArrayLength="16384" 
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<security mode="TransportCredentialOnly">
<transport clientCredentialType="Ntlm" proxyCredentialType="None" realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />


Add variables

Add the variables you will use to work with the endpoint to the class. Identify the pieces of information you need to interact with the endpoint. In the code sample, you are publishing to the workflow named "workflowpublishformsource"



string workflowName = "PublishFormXMLtoTarget"; //
            string sourceListName = "workflowpublishformsource"; // 
            string workflowfile = "";
            string fullFilePath = @"C:\out\exportworkflow.nwf";


Instantiate the SOAP client

With the service references, you can access the NintexWorkflowWSSoapClient. Instantiate the SOAP Client, and then add your user name, password, domain. In addition you can specify NTLM and allow for impersonation.



 NintexWorkflowWSSoapClient soapClient = new NintexWorkflowWSSoapClient("NintexWorkflowWSSoap"); //need to name the endpoint being used.
            soapClient.ClientCredentials.Windows.ClientCredential.UserName = "UserName";
            soapClient.ClientCredentials.Windows.ClientCredential.Password = "Password";
            soapClient.ClientCredentials.Windows.ClientCredential.Domain = "Domain"; /optional
            soapClient.ClientCredentials.Windows.AllowNtlm = true; /optional
            soapClient.ClientCredentials.Windows.AllowedImpersonationLevel = System.Security.Principal.TokenImpersonationLevel.Impersonation; //optional


Use the endpoints

You can specify the specific endpoint using the SOAP client object. In this example, you are retrieving the workflow and assigning to the workflowfile string variable.

For more information on the available Nintex Workflow endpoint, see Service operations.



           bool copied = getWorkflow(soapClient, workflowName, sourceListName, workflowfile, fullFilePath);

        static public bool getWorkflow(NintexWorkflowWSSoapClient soapClient, string workflowName, string sourceListName, string workflowfile, string fullFilePath )
                workflowfile = soapClient.ExportWorkflow(

                System.IO.File.WriteAllText(fullFilePath, workflowfile, Encoding.Unicode);
                return true;
            catch (Exception ex)
                return false;


Related information

Modifying and Extending Nintex Workflow and Forms

Web Service Reference

Client Configuration