From f9055a10411ba32eabc44e50f34e173c4a390d1f Mon Sep 17 00:00:00 2001 From: Sipke Schoorstra Date: Sat, 12 Sep 2026 00:39:29 -0700 Subject: [PATCH] feat(apps): enable BPMN interchange in the Elsa.Server.Web sample host (#8068) * feat(apps): enable BPMN interchange in the Elsa.Server.Web sample host Turns on .UseBpmnInterchange() unconditionally alongside the host's other showcase features so the analyze endpoint (and BPMN execution) can be exercised end-to-end against a live server, per #8055 (part of #7909). Co-Authored-By: Claude Opus 5 * docs(bpmn): fix sample host method names to UseBpmn/UseBpmnInterchange The enabling-BPMN sample referenced AddBpmn()/AddBpmnInterchange(), which do not exist; the real extension methods are UseBpmn() and UseBpmnInterchange(). Co-Authored-By: Claude Opus 5 * docs(bpmn): note dev-certs trust prerequisite for analyze example The login curl in the "Trying it" walkthrough fails TLS verification when the local ASP.NET Core development certificate isn't trusted, leaving TOKEN empty. Document the one-time dotnet dev-certs --trust step instead of suggesting curl -k. Co-Authored-By: Claude Opus 5 --------- Co-authored-by: Claude Opus 5 --- doc/wiki/bpmn-workflows.md | 22 ++++++++++++++++--- .../Elsa.Server.Web/Elsa.Server.Web.csproj | 1 + src/apps/Elsa.Server.Web/Program.cs | 1 + 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/doc/wiki/bpmn-workflows.md b/doc/wiki/bpmn-workflows.md index 15e6a2fcd..4fee8e06c 100644 --- a/doc/wiki/bpmn-workflows.md +++ b/doc/wiki/bpmn-workflows.md @@ -11,13 +11,29 @@ Elsa supports running BPMN 2.0 processes as first-class workflow activities. Two ```csharp // Execution support only (use when you build BpmnProcess in code). -elsa.AddBpmn(); +elsa.UseBpmn(); // Execution + XML interchange (use when importing .bpmn files). -elsa.AddBpmnInterchange(); +elsa.UseBpmnInterchange(); ``` -`BpmnInterchangeFeature` depends on `BpmnFeature`; calling `AddBpmnInterchange()` pulls in both. +`BpmnInterchangeFeature` depends on `BpmnFeature`; calling `UseBpmnInterchange()` pulls in both. + +### Trying it + +The sample host `src/apps/Elsa.Server.Web` has BPMN interchange enabled (`.UseBpmnInterchange()` in its `Program.cs`), so it can be used to try the analyze endpoint against a real server. If you have not already trusted the local ASP.NET Core development certificate, run `dotnet dev-certs https --trust` once, otherwise the `curl` calls below will fail TLS verification. Sign in with one of the development users (e.g. `admin`/`password`, see `appsettings.Development.json`) to obtain a bearer token, then call the endpoint: + +```bash +TOKEN=$(curl -s -X POST https://localhost:5001/elsa/api/identity/login \ + -H "Content-Type: application/json" \ + -d '{"username":"admin","password":"password"}' | jq -r .accessToken) + +curl -s -X POST https://localhost:5001/elsa/api/bpmn/analyze \ + -H "Authorization: Bearer $TOKEN" \ + -F "file=@test/integration/Elsa.Bpmn.Interchange.IntegrationTests/Assets/camunda-order-process.bpmn" +``` + +This returns a JSON body of process ids, element counts, and findings (e.g. informational notes about unbound service tasks or retained vendor extensions). ## BpmnProcess Activity diff --git a/src/apps/Elsa.Server.Web/Elsa.Server.Web.csproj b/src/apps/Elsa.Server.Web/Elsa.Server.Web.csproj index ba9dce4c4..0781af803 100644 --- a/src/apps/Elsa.Server.Web/Elsa.Server.Web.csproj +++ b/src/apps/Elsa.Server.Web/Elsa.Server.Web.csproj @@ -1,6 +1,7 @@ + diff --git a/src/apps/Elsa.Server.Web/Program.cs b/src/apps/Elsa.Server.Web/Program.cs index 8336e96d5..eccc813b0 100644 --- a/src/apps/Elsa.Server.Web/Program.cs +++ b/src/apps/Elsa.Server.Web/Program.cs @@ -100,6 +100,7 @@ services .UseFluentStorageProvider() .UseElsaScriptBlobStorage() .UseScheduling() + .UseBpmnInterchange() .UseCSharp(options => { configuration.GetSection("Scripting:CSharp").Bind(options);