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 <noreply@anthropic.com>

* 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 <noreply@anthropic.com>

* 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 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Sipke Schoorstra 2026-09-12 00:39:29 -07:00 committed by GitHub
parent 3bee566657
commit f9055a1041
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 21 additions and 3 deletions

View file

@ -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

View file

@ -1,6 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<ItemGroup>
<ProjectReference Include="..\..\modules\Elsa.Bpmn.Interchange\Elsa.Bpmn.Interchange.csproj" />
<ProjectReference Include="..\..\modules\Elsa.Caching\Elsa.Caching.csproj" />
<ProjectReference Include="..\..\modules\Elsa.Common\Elsa.Common.csproj" />
<ProjectReference Include="..\..\modules\Elsa.Dashboard.Api\Elsa.Dashboard.Api.csproj" />

View file

@ -100,6 +100,7 @@ services
.UseFluentStorageProvider()
.UseElsaScriptBlobStorage()
.UseScheduling()
.UseBpmnInterchange()
.UseCSharp(options =>
{
configuration.GetSection("Scripting:CSharp").Bind(options);