Start building

Transform and map

XML order → JSON response

Your first complete integration: validate an XML order, transform it in a reusable subprocess, route with XPath and return a JSON response. Try success and two failure paths.

  • XML → JSON
  • Starter
  • 4 min

Last verified 2026-10-31 at f4ce7d0 — simulation fixtures

Try this template in Studio

Studio activation is a one-time payment of USD 20.

Flow

Drawn at build time from the node positions in the template's process definitions. Numbered markers are the walkthrough stages.

Main processOrder intake8 activities

Scroll sideways to see the whole flow.

Flow diagram of Order intake8 activities and 9 transitions: Receive request, Normalize order, Validate total, Accept order, Invalid total, Render JSON, Build error response, Return response.Valid orderOtherwiseTransform errorBusiness faultReceive requeststart1Normalize ordercall_processValidate totalchoice3Accept orderassignInvalid totalraise_errorRender JSONjson.renderBuild error responseassignReturn responseend4
List the 8 activities and 9 transitions

Activities

  1. Receive request start
  2. Normalize order call_process
  3. Validate total choice
  4. Accept order assign
  5. Invalid total raise_error
  6. Render JSON json.render
  7. Build error response assign
  8. Return response end

Transitions

  • Receive request → Normalize order (on success)
  • Normalize order → Validate total (on success)
  • Validate total → Accept order (condition: Valid order)
  • Validate total → Invalid total (otherwise: Otherwise)
  • Accept order → Render JSON (on success)
  • Render JSON → Return response (on success)
  • Normalize order → Build error response (on error: Transform error)
  • Invalid total → Build error response (on error: Business fault)
  • Build error response → Return response (on success)
SubprocessNormalize order · subprocess7 activities

Scroll sideways to see the whole flow.

Flow diagram of Normalize order · subprocess7 activities and 6 transitions: Start, Parse order XML, Validate order XSD, Normalize with XSLT, Parse normalized XML, Map to JSON object, Return order.StartstartParse order XMLxml.parseValidate order XSDxml.validateNormalize with XSLTxml.xslt2Parse normalized XMLxml.parseMap to JSON objectassignReturn orderend
List the 7 activities and 6 transitions

Activities

  1. Start start
  2. Parse order XML xml.parse
  3. Validate order XSD xml.validate
  4. Normalize with XSLT xml.xslt
  5. Parse normalized XML xml.parse
  6. Map to JSON object assign
  7. Return order end

Transitions

  • Start → Parse order XML (on success)
  • Parse order XML → Validate order XSD (on success)
  • Validate order XSD → Normalize with XSLT (on success)
  • Normalize with XSLT → Parse normalized XML (on success)
  • Parse normalized XML → Map to JSON object (on success)
  • Map to JSON object → Return order (on success)

Walkthrough

  1. Receive an XML orderThe sample input contains a realistic order with a customer, amount and currency.
  2. Normalize in a subprocessParse XML, validate its XSD, apply XSLT and map the result.
  3. Choose the business routeOnly positive order totals follow the accepted branch.
  4. Inspect the resultCompare the captured response and the assertions in Test & trace.

What you will practise

  • Follow the call from the parent into its own reusable subprocess.
  • Inspect schema validation, XSLT transformation and XPath routing.
  • Compare a valid order with malformed XML and a business-rule rejection.

Sample cases

3 cases with 15 assertions, run with python -m server.integration examples --all in simulation.

Valid order

Passed

An order for EUR 249.90 should be accepted.

Expected result A rendered JSON response with accepted: true and order ORD-1042, EUR 249.90.

6/6 assertions

  • Process completes in simulation
  • The order is accepted
  • Amount remains numeric
  • Currency is preserved
  • XSLT subprocess executed
  • Error handler was not used

This sample run only; not a production certification.

Negative total

Passed

Change the amount to -2 and follow the Otherwise/error branch.

Expected result A handled rejection with accepted: false and error code invalid_order_total.

5/5 assertions

  • Process completes in simulation
  • The order is rejected
  • Business fault is explicit
  • Error was handled
  • Accepted branch was skipped

This sample run only; not a production certification.

Malformed XML

Passed

Invalid XML fails inside the child and is handled by the parent.

Expected result A handled parse failure, not an accepted order.

4/4 assertions

  • Process completes in simulation
  • The order is rejected
  • Subprocess error was caught
  • XSLT was not attempted

This sample run only; not a production certification.

Prerequisites

Runtime
Cohuno runtime 1.27.0, the version recorded when these cases last passed.
Starter
Manual start; no listener.
Optional dependencies
None beyond the base runtime.
Simulation fixtures
None: no activity in this template uses a connector.
Verification details

Provenance

What was verified, and when. The content part changes whenever the pack, a process in its closure, the runtime version or a case result changes; the gallery check then fails until the gallery is regenerated and the changed templates are verified again.

Verified content

Pack SHA-256
35a9b463c23b5772c7d1e5e9904b2e9786887373e7da57f1a257c53f78087b18
Closure SHA-256
b7fdf485cb3f7b6709aca580b708638f9307bccb57d8a5ba68a2e7220b2079c5
Runtime
1.27.0
Results
3/3 cases, 15/15 assertions, mode simulate, external calls: none.
Files in the closure
  • server/integration/example_packs/order_to_json.json
  • server/integration/templates/normalize_order.json
  • server/integration/templates/order_intake.json

Verification event

Commit
f4ce7d08eedc90267b405ed1974344153a8b3a34
Verified at (UTC)
2026-10-31T21:19:21Z

How the Cohuno team reproduces this check

PYTHONPATH=. python -m server.integration examples --example order_to_json
PYTHONPATH=. python scripts/export_public_gallery.py --check