Loading…
Loading…
Use the internal Test Execution API endpoint to test SOAP-to-REST transformations for draft and published service versions without calling production
The Test Execution endpoint provides a mechanism for API publishers to test the SOAP-to-REST transformation of a specific API operation. It is an internal-only endpoint, primarily invoked by the "Test Operation" feature in the administration user interface.
This endpoint solves the problem of testing changes to an API's transformation logic in isolation. It allows for execution against draft or unpublished service versions, enabling iterative development and validation before a new version is published. It can also test operations for which a full OpenAPI specification has not yet been generated, using a synthetic schema derived from the underlying WSDL.
The endpoint receives a REST-style request, transforms it into a SOAP request, calls the backend SOAP service, processes the SOAP response, and returns a detailed JSON object that includes the raw SOAP messages, performance metrics, and a classification of the outcome.
IMPORTANT
This endpoint is not exposed to the public internet and is only accessible from within the platform's internal network. All requests must be authenticated using a short-lived JSON Web Token (JWT).
The Test Execution endpoint follows a multi-step process to execute a test and report its results. The entire outcome, whether successful or not, is typically wrapped in an HTTP 200 OK response containing a detailed JSON body.
flowchart TD
A[API Consumer] --> B{Test Execution Endpoint};
B --> C[1. Authenticate Request (JWT)];
C -- Fails --> Z1[Return 401 Unauthorized];
C -- OK --> D[2. Find Route Configuration];
D -- Fails --> Z2[Return 404/500 Error];
D -- OK --> E[3. Validate Request Body (JSON only)];
E -- Fails --> F[Return 200 with Validation Report];
E -- OK --> G[4. Transform REST to SOAP Request];
G -- Fails --> H[Return 200 with Transformation Error];
G -- OK --> I[5. Call Backend SOAP Service];
I -- Transport Error --> J[Report Platform Error];
I -- Success --> K[6. Parse SOAP Response];
K -- Parse Fails --> J;
K -- OK --> L[7. Classify Result];
L -- SOAP Fault --> M[Report Backend Fault];
L -- Applicative Error --> N[Report Applicative Error];
L -- Success --> O[Report Success];
subgraph "Final Response (HTTP 200 OK)"
F
H
J
M
N
O
end
J --> P[Assemble & Return Detailed JSON];
M --> P;
N --> P;
O --> P;
F --> P;
H --> P;Authorization header. It expects a Bearer token containing an HMAC-signed JWT. The token's signature, expiration, audience (s2r-runtime-test-execute), and claims (versionId, operationKey) are all validated.serviceVersionId and operationKey from the URL. This lookup is "draft-aware," meaning it can find and use configuration for service versions that have not yet been published.Content-Type variations:
application/json (or unspecified): The JSON body is transformed into a SOAP body based on the operation's mappings.application/xml: The XML body is treated as a fragment and wrapped in a standard SOAP envelope.text/xml: The body is assumed to be a complete SOAP envelope and is passed through as-is.WARNING
The test execution call does not use any configured backend credentials. The request is sent to the backend service without authentication. Retries are disabled for test calls.
errorOrigin). This helps distinguish between validation errors, platform issues (e.g., timeouts), and errors originating from the backend.POST /_test/v1/{serviceVersionId}/{operationKey}Executes a test run for a specific operation.
| Name | Type | Required | Description |
|---|---|---|---|
serviceVersionId | UUID | Yes | The unique identifier of the service version to test. |
operationKey | String | Yes | The unique key for the operation within the service version. |
| Name | Required | Description |
|---|---|---|
Authorization | Yes | Bearer token containing a short-lived JWT for authentication. See Authentication. |
Content-Type | No | Specifies the format of the request body. Can be application/json, application/xml, or text/xml. Defaults to application/json if absent. |
X-Correlation-Id | No | A UUID for tracing the request. If not provided, a new one is generated. |
The request body's format is determined by the Content-Type header.
application/json: A JSON object matching the operation's request schema.application/xml: An XML fragment representing the content of the SOAP <body>.text/xml: A full, valid SOAP envelope, including the <Envelope> element.If the request body is empty, it is treated as an empty JSON object ({}) or an empty string for XML.
The endpoint returns an HTTP 200 OK for most outcomes, with a detailed JSON body describing the result. Only critical, pre-flight failures (like invalid authentication) result in a non-200 status code.
Example Response Structure:
{
"testMode": true,
"schemaValidation": {
"passed": true
},
"executionResult": {
"latencyMs": 150,
"rawSoapRequest": "...",
"httpStatus": 200,
"responseBody": {
"field": "value"
},
"rawSoapResponse": "...",
"soapFault": false
},
"errorOrigin": "SUCCESS",
"errorDetail": {},
"correlationId": "f81d4fae-7dec-11d0-a765-00a0c91e6bf6"
}
Top-Level Fields:
| Field | Type | Description |
|---|---|---|
testMode | Boolean | Always true for responses from this endpoint. |
schemaValidation | Object | Contains the result of the OpenAPI schema validation. See Schema Validation Object. |
executionResult | Object | Details of the backend call execution. This will be null if schema validation blocked the call. See Execution Result Object. |
errorOrigin | String | A machine-readable classification of the test outcome. See Error Origin Classification. |
errorDetail | Object | A structured object containing details about any error that occurred. The content varies by errorOrigin. |
correlationId | String | The correlation ID for the test execution. |
This object reports the outcome of validating the incoming JSON request against the operation's schema.
| Field | Type | Description |
|---|---|---|
skipped | Boolean | true if validation was skipped (e.g., for an XML request). |
reason | String | If skipped, provides a code explaining why (e.g., xml-request-body). |
passed | Boolean | true if the request body was valid. |
blocked | Boolean | true if the request was invalid and the call to the backend was blocked. |
violations | Array | An array of violation objects if the request was invalid. |
A violation object has the following structure:
| Field | Type | Description |
|---|---|---|
field | String | The JSON path to the field that failed validation. |
rule | String | The schema rule that was violated (e.g., required, pattern). |
message | String | A human-readable description of the violation. |
This object contains the details of the interaction with the backend SOAP service.
| Field | Type | Description |
|---|---|---|
latencyMs | Number | Total time in milliseconds for the backend call and response processing. |
rawSoapRequest | String | The exact SOAP envelope sent to the backend service. |
httpStatus | Number | The HTTP status code returned from the backend call. For transport errors, this is an inferred status (e.g., 504 for timeout). |
error | String | A platform-specific error code (e.g., S2R-RUN-0504) if a platform or transport error occurred. |
message | String | A human-readable message describing the outcome or error. |
responseBody | Object | The JSON-transformed body of the SOAP response. Present on success. |
rawSoapResponse | String | The raw SOAP response body received from the backend service. |
soapFault | Boolean | true if the backend returned a valid SOAP Fault. |
fault | Object | If soapFault is true, this object contains the parsed content of the SOAP Fault. |
applicativeError | Boolean | true if the response was not a SOAP Fault but matched a configured applicative error marker. |
applicativeWarning | String | The name of a matched advisory marker, which indicates the presence of a field but does not imply an error. |
The errorOrigin field provides a single, high-level category for the test outcome.
| Value | Description |
|---|---|
SUCCESS | The test completed successfully. The backend returned a 2xx response that was not a SOAP Fault and did not match any applicative error markers. |
SPEC_VALIDATION | The request failed validation before the backend was called. This includes OpenAPI schema violations and failures to build the SOAP envelope from the request. |
PLATFORM | An error occurred within the API platform. This includes backend connection timeouts, DNS failures, TLS handshake errors, or an inability to parse the backend's SOAP response. |
BACKEND_FAULT | The backend service responded with a valid SOAP Fault envelope. |
APPLICATIVE_ERROR | The backend service returned a non-fault response, but its content matched a configured applicative error pattern, indicating a business-level error. |
Authentication is handled via a JSON Web Token (JWT) passed in the Authorization header.
Authorization: Bearer <token>TEST_EXECUTE_HMAC_KEY. A fallback to the S2R_TEST_EXECUTE_HMAC_KEY environment variable is supported for development or legacy configurations.HTTP 503 Service Unavailable. Once the key is provisioned, subsequent calls will succeed without requiring a platform restart.aud (Audience): Must be exactly s2r-runtime-test-execute.versionId: Must match the serviceVersionId in the URL path.operationKey: Must match the operationKey in the URL path.exp (Expiration Time): Tokens are short-lived, with a typical TTL of 5 minutes.The endpoint uses a combination of standard HTTP status codes for fatal errors and a detailed JSON body for test-run outcomes.
These codes indicate a problem that prevented the test from running at all.
| Status | Error Code | Reason |
|---|---|---|
401 Unauthorized | S2R-VAL-0420 | The Authorization header is missing, malformed, or the JWT is invalid (bad signature, incorrect claims). |
401 Unauthorized | S2R-VAL-0421 | The provided JWT has expired. |
404 Not Found | S2R-RUN-0404 | The specified serviceVersionId or operationKey does not exist. |
503 Service Unavailable | S2R-RUN-0422 | The HMAC signing key for test execution has not been provisioned in the system. |
These codes appear within the executionResult or errorDetail objects in the 200 OK JSON response.
| Error Code | Inferred Status | Origin | Description |
|---|---|---|---|
S2R-VAL-0400 | 400 | SPEC_VALIDATION | Failed to build the SOAP envelope from the request body. The request payload may be malformed or inconsistent with the mapping rules. |
S2R-RUN-0424 | 504 | PLATFORM | The request to the backend SOAP service timed out. |
S2R-RUN-0503 | 503 | PLATFORM | The backend endpoint URL is not configured for the operation, or a generic connection error occurred. |
S2R-RUN-0504 | 502 | PLATFORM | The platform successfully received a response from the backend, but could not parse it as valid SOAP. |
S2R-RUN-0505 | 502 | PLATFORM | The internal SOAP client failed to produce a result. |
S2R-RUN-0529 | 503 | PLATFORM | The circuit breaker to the backend service is open. |
APPLICATIVE_ERROR origin is determined by matching the SOAP response against configured error markers.