/// <summary> /// Create Workflow in WexFlow /// </summary> /// <param name="payload"></param> /// <returns></returns> public int Create(string payload) { var client = new WexflowServiceClient(_configs.WexflowWebServiceUri); var created = client.CreateWorkflow(_configs.Username, _configs.Password, payload); // return workflowId if (created) { var o = JObject.Parse(payload); var wi = o.Value <JObject>("WorkflowInfo"); var id = wi.Value <int>("Id"); return(id); } return(-1); }
static void Main(string[] args) { try { IConfiguration config = new ConfigurationBuilder() .AddJsonFile("appsettings.json", optional: true, reloadOnChange: true) .Build(); var wexflowServiceUri = config["WexflowWebServiceUri"]; var username = config["Username"]; var password = config["Password"]; var client = new WexflowServiceClient(wexflowServiceUri); // Test create var res = client.CreateWorkflow(username, password, createPayload); Console.WriteLine("Create result: {0}", res); // Test update res = client.UpdateWorkflow(username, password, updatedPayload); Console.WriteLine("Update result: {0}", res); // Test read var xml = client.ReadWorkflow(username, password, 999); Console.WriteLine("Read result: {0}", xml); // Test delete res = client.DeleteWorkflow(username, password, 999); Console.WriteLine("Delete result: {0}", res); } catch (Exception e) { Console.WriteLine("Error: {0}", e); } Console.WriteLine("Press any key to exit..."); Console.ReadKey(); }