Loading…
Loading…
Technical reference for the Runtime API, the live data plane for request conversion. Details the publish (REST-to-SOAP) and consume (SOAP-to-REST)
The Runtime API is the live traffic-handling component of the platform. It is the endpoint that API consumers interact with directly to perform SOAP-to-REST and REST-to-SOAP conversions. The runtime's primary function is to receive an inbound request, match it to a configured service route, transform the payload, invoke the backend service, transform the response, and return the result to the original caller.
Each request is assigned a correlation ID, which is used for end-to-end tracing. The Runtime API itself is designed to be an internal service, fronted by an API gateway or ingress controller that manages inbound client authentication. The runtime's own credential management pertains to the outbound calls it makes to backend services.
The API is organized into two primary "directions":
publish: Exposes a SOAP backend as a modern REST/JSON API.consume: Exposes a REST backend as a SOAP web service to support legacy clients.The runtime processes requests based on a URL structure that dictates the conversion direction and identifies the target service and operation.
The base path for all runtime requests follows this pattern:
/{direction}/{environment}/{serviceKey}/{operationPath...}
The runtime strips the leading /{direction}/ segment to match the request against a stored route (/{environment}/{serviceKey}/{operationKey}) and processes the request according to that direction.
flowchart TD
subgraph REST to SOAP (Publish)
A[API Consumer] -- JSON Request --> B(Runtime API: /publish/...);
B -- SOAP Request --> C[SOAP Backend];
C -- SOAP Response --> B;
B -- JSON Response --> A;
end
subgraph SOAP to REST (Consume)
D[SOAP Client] -- SOAP Request --> E(Runtime API: /consume/...);
E -- JSON Request --> F[REST Backend];
F -- JSON Response --> E;
E -- SOAP Response --> D;
endA request that omits or misspells the direction segment will be rejected. If the direction is valid but no matching route is found, the runtime returns a 404 Not Found error.
# Publish direction: Exposes a SOAP backend as a REST API
POST /publish/dev/vehicle/license-status
POST /publish/prod/<customer>/data-sent-to-office-request
GET /publish/dev/citizen/{citizenId}
# Consume direction: Exposes a REST backend as a SOAP service
POST /consume/prod/legacy-citizen/get-citizen
The publish direction exposes a SOAP backend as a REST/JSON API. The runtime converts an inbound REST request into a SOAP envelope, calls the backend, and transforms the SOAP response back into a JSON payload.
Path: /{publish}/{environment}/{serviceKey}/{operationPath...}
Content-Type: The primary expected content type is application/json. application/xml is also accepted for specific operations configured for SOAP-fragment passthrough.POST is used for standard operations. GET and DELETE routes can be generated, with path and query parameters being merged into a JSON payload before the SOAP conversion.A successful publish request returns a JSON object containing metadata about the transaction and the mapped result from the backend. The response includes X-Correlation-Id and Content-Type: application/json headers.
{
"correlationId": "...",
"environment": "prod",
"path": "/publish/prod/vehicle/license-status",
"serviceKey": "vehicle",
"operationKey": "license-status",
"backendLatencyMs": 38,
"result": { "...": "mapped SOAP payload" }
}
Errors in the publish direction are returned in a standard JSON error envelope. See the Troubleshooting section for specific error codes.
The consume direction exposes a REST backend as a traditional SOAP web service. This allows existing SOAP clients to continue functioning without modification while the backend is migrated to a RESTful architecture.
Path: POST /consume/{environment}/{serviceKey}/{operationPath...}
POST is permitted. Any other HTTP method will result in a 405 Method Not Allowed error (S2R-RUN-0411).Content-Type: The runtime accepts both major SOAP versions, identified by their content type:
text/xmlapplication/soap+xmlThe runtime detects the SOAP version from the envelope's XML namespace and formats the response (or fault) in the same version.
For each consume service, the runtime provides a WSDL document that serves as the contract for SOAP clients. The WSDL can be retrieved via a GET request to one of two endpoints:
GET /consume/{env}/{serviceKey}?wsdlGET /consume/{env}/{serviceKey}/wsdlBoth endpoints return the active WSDL with a Content-Type of application/wsdl+xml; charset=UTF-8.
All errors on consume paths, including validation failures, backend errors, and timeouts, are returned as a SOAP Fault envelope. This ensures that SOAP clients receive an error in the format they expect. The fault will contain the relevant S2R-* error code. For example, an oversized payload results in a soap:Client fault with an HTTP 413 status.
| Header | Direction | Notes |
|---|---|---|
Content-Type | Both | application/json is primary for publish. text/xml (SOAP 1.1) and application/soap+xml (SOAP 1.2) are used for consume. |
Accept | publish | Defaults to application/json. |
X-Correlation-Id | Both | Optional. If a client provides this header, its value is used for tracing. If absent, the runtime generates a new ID and includes it in the response. |
X-Debug-Enabled | Both | Optional. This header is only honored for requests from authorized internal callers or those matching a specific policy. The source does not specify its behavior. |
The maximum synchronous payload size is 30 MB. A request with a body larger than this limit will be rejected with an HTTP 413 Payload Too Large status.
publish routes, the error is a standard JSON envelope with code S2R-RUN-0413 and maxPayloadMb: 30 in the details.consume routes, the error is a SOAP Fault (soap:Client).The runtime handles payloads as UTF-8 end-to-end. This includes JSON requests, generated SOAP XML, backend responses, and stored traces.
The runtime includes several mechanisms to ensure resilience when communicating with backend services.
1000 ms2Both the timeout and the number of retries can be overridden on a per-operation basis via the control plane. For consume routes, retries use a capped exponential backoff strategy, configurable with retry_count and retry_backoff_ms in the backend profile.
The runtime implements a process-local circuit breaker for each backend endpoint to prevent repeated calls to a failing service.
503 S2R-RUN-0529.These thresholds are tunable via environment variables.
Operations can be configured with a fallback policy for transport failures (timeout, io_error, unknown_error, circuit_open). If a configured failure occurs, the runtime returns a pre-configured static payload and status code instead of an error. When a fallback is triggered, the response includes the header X-S2R-Fallback: true.
For publish routes, SOAP faults from the backend are mapped to deterministic HTTP status codes. This mapping is configurable per operation. The default mappings are:
400 Bad Request502 Bad Gateway504 Gateway Timeout503 Service UnavailableWhen calling a SOAP backend (publish direction), the runtime uses the soap_version configured in the backend profile to generate the correct envelope and headers.
http://schemas.xmlsoap.org/soap/envelope/Content-Type: text/xml; charset=utf-8SOAPAction header is included if specified.http://www.w3.org/2003/05/soap-envelopeContent-Type: application/soap+xml; charset=utf-8action="...") when present.The runtime supports multiple authentication methods for outbound calls to both SOAP and REST backends. All credential material is decrypted on-demand from the service's backend profile.
none, basic, bearer, api_key_header, oauth2_client_credentials.mTLS can be enabled (mtls_enabled=true) independently of the authentication type. It applies to both the primary backend call and any calls to an OAuth2 token endpoint.The following environment variables can be used to tune the circuit breaker behavior.
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
S2R_RUNTIME_CB_FAILURE_THRESHOLD | integer | 5 | No | The number of consecutive failures to open the circuit breaker. |
S2R_RUNTIME_CB_OPEN_SECONDS | integer | 30 | No | The duration in seconds the circuit breaker remains open. |
The runtime returns specific error codes to help diagnose issues.
| Code | HTTP Status | Direction | Meaning |
|---|---|---|---|
S2R-RUN-0404 | 404 | Both | A valid direction was provided, but no published route matched the request path. |
S2R-RUN-0405 | 400 | Both | The required /publish/ or /consume/ direction segment was missing or misspelled in the URL. |
S2R-RUN-0408 | 400 | consume | An unsupported Content-Type was provided for a SOAP request. |
S2R-RUN-0409 | 400 | consume | The inbound SOAP envelope was malformed. Returned as a soap:Client fault. |
S2R-RUN-0410 | 4xx | consume | The backend REST service returned a 4xx client error. Returned as a soap:Client fault. |
S2R-RUN-0411 | 405 | consume | An HTTP method other than POST was used on a /consume path. |
S2R-RUN-0413 | 413 | Both | The request payload exceeds the 30 MB limit. |
S2R-RUN-0419 | — | — | A required credential key was missing at startup. The runtime will not serve traffic. |
S2R-RUN-0420 | — | — | A configured mTLS certificate was missing or could not be parsed at startup. |
S2R-RUN-0421 | 500 | consume | The stored WSDL for a service could not be parsed when requested. |
S2R-RUN-0424 | 504 | publish | The backend call timed out. |
S2R-RUN-0429 | 503 | publish | All configured retry attempts to the backend failed. |
S2R-RUN-0502 | 502 | publish | The backend returned a SOAP fault. |
S2R-RUN-0505 | 500 | consume | There is a configuration gap for authenticating to the backend REST service. |
S2R-RUN-0506 | 500 | Both | A serialization error occurred, such as a backend response not matching the contract. |
S2R-RUN-0529 | 503 | publish | The circuit breaker for the backend is open. |
S2R-VAL-0400 | 400 | publish | The inbound JSON request failed validation against the operation's schema. |
NOTE
On consume routes, all errors are returned as SOAP Fault envelopes to maintain compatibility with SOAP clients. On publish routes, errors are returned in a standard JSON error envelope.