Skip to main content

Hello,

I have created an Provider-hosted app which create sub-sites. I have a workflow that I've attached to a list in CSOM code.

Code :

private void AttachNintexWorkflowToList(ClientContext a_context, string a_urlDomaine)
{
       Web website = a_context.Web;

        a_context.Load(website);
        website.EnsureProperty(x => x.Url);

      // Reading the workflow
       byteb] nwffile = GetWorkflowNWF();

    // //Publishing Nintex workflows does not work over https
    if (a_urlDomaine.Contains("https"))
     {
         a_urlDomaine = a_urlDomaine.Replace("https", "http");
      }

// Call the Nintex web service to publish the workflow
var ws = new ServiceNintex.NintexWorkflowWSSoapClient("NintexWorkflowWSSoap");
if (ws != null)
      {
                 ws.Endpoint.Address = new System.ServiceModel.EndpointAddress(new Uri(a_urlDomaine +                      "/_vti_bin/nintexworkflow/workflow.asmx"),
               ws.Endpoint.Address.Identity, ws.Endpoint.Address.Headers);

               ws.ClientCredentials.Windows.ClientCredential = CredentialCache.DefaultNetworkCredentials;

                ws.Open();

               ws.PublishFromNWF(nwffile, "Demandes", "WFDemande", true);
      }
}

private byte ] GetWorkflowNWF()
{
      using (FileStream nwfFile = System.IO.File.Open(pathToNWF, FileMode.Open, FileAccess.Read))
       {
            byte ] buffer = new bytea1024];
            using (MemoryStream memoryStream = new MemoryStream())
            {
                   int read;
                  while ((read = nwfFile.Read(buffer, 0, buffer.Length)) > 0)
                  {
                     memoryStream.Write(buffer, 0, read);
                  }

                  return memoryStream.ToArray();
            }
      }
}

But, I have an error at the opening. 

194384_pastedImage_9.png

Error retrieving config xml for activity 'State' using adapter type Nintex.Workflow.Activities.Adapters.NWState2Adapter,
Nintex.Workflow, Version=1.0.0.0, Culture=neutral, PublicKeyToken=913f6bae0ca5ae12.

194383_pastedImage_3.png

And in logs I've this exception :

Nintex.Workflow.NWActivityAdapterInvokeException: Error retrieving config xml for activity 'State' using adapter type Nintex.Workflow.Activities.Adapters.NWState2Adapter, Nintex.Workflow, Version=1.0.0.0, Culture=neutral, PublicKeyToken=913f6bae0ca5ae12. ---> System.NullReferenceException: Object reference not set to an instance of an object. at Nintex.Workflow.Activities.Adapters.NWState2Adapter.GetConfig(Activity a, List`1 supportingActivities, Hashtable ... 

Any ideas on how to fix it?

Cordially.

Be the first to reply!

Reply