Loading…
Loading…
Diagnose and regenerate SOAP-to-REST operation mappings. This service provides tools to assess mapping readiness and bulk-update them after WSDL changes.
The Mapping Automation Service provides functionality to diagnose and regenerate the SOAP-to-REST mappings for API operations. When a backend SOAP service's WSDL contract is updated, the corresponding mappings that translate REST-style API consumer requests into SOAP and vice-versa must also be updated. This service automates that process.
Its primary functions are:
This service is typically invoked via an administrative API to manage the lifecycle of SOAP-to-REST mappings, particularly after a new WSDL has been imported for a service. It reads from and writes to the platform's mapping and service definition repositories.
The service offers two main capabilities: diagnosis and regeneration.
The diagnosis functions (diagnoseOperation, diagnoseService) evaluate how well an existing operation mapping aligns with its underlying SOAP contract.
For a given operation, the process is:
OperationMappingRecord.evaluateReadiness function to compare the two.evaluateReadiness performs a series of checks, generating errors, warnings, or informational notes. Key checks include:
mappingEngineVersion should be the expected version (contract-mapping-v2).contractChecksum must exist on both the operation's schema and the mapping, and they must match.contract-json-to-soap for requests and contract-soap-to-json for responses.readiness status:
AUTO_READY: No errors or warnings. The mapping is considered healthy.AUTO_READY_WITH_WARNINGS: No errors, but warnings are present. The mapping is functional but may be outdated or suboptimal.MANUAL_REQUIRED: Errors are present. The mapping is likely broken or incomplete and requires manual intervention.The diagnoseService function aggregates these results for all operations within a service, providing a summary of the service's overall mapping health.
The regeneration functions (regenerateOperation, regenerateService, regenerateAllDraftServices) create a new version of an operation's mapping. All regeneration calls flow through a canonical regenerateOneOperation method to ensure consistent behavior.
IMPORTANT
Regeneration can only be performed on operations belonging to a "mutable" service version. A service version is considered mutable if its status is draft and it is not active (is_active = false). Operations on active or published service versions are immutable and will be skipped.
The regeneration process for a single operation follows these steps:
flowchart TD
A[Start Regeneration] --> B{Is WSDL source available?};
B -->|Yes| C[Re-parse WSDL and imported schemas];
C --> D{Schema quality check};
D -->|No (Degraded)| E[Use previously stored schema];
D -->|Yes (OK)| F[Update stored schema];
B -->|No| E;
E --> G[Generate new mapping using stored schema];
F --> H[Generate new mapping using fresh schema];
G --> I{Preserve manual rules & auto-match fields};
H --> I;
I --> J[Save new mapping version];
J --> K[End];regenerateActiveWithPreservation, which attempts to carry forward manual customizations (such as rules) from the previous active mapping. It also uses an auto-matching algorithm to map fields that may have been renamed between WSDL versions, comparing the old and new schemas.OperationMappingRecord is created and persisted. The process captures any manual customizations that could not be preserved (droppedCustomizations) and any fields that were successfully auto-matched (appliedAutoMatches).A critical part of regeneration is the rederiveSchemasFromWsdl step. To ensure correctness, the WSDL parser loads the entire "schema closure" (the main WSDL file and all its imported XSDs) that was captured when the WSDL was first imported.
NOTE
A degradation guard is in place to prevent data loss. If re-parsing the WSDL results in a schema with fewer resolved data types than the currently stored schema, the process is aborted for that operation. This typically happens if the original WSDL import occurred on an older platform version that did not store the full schema closure. In this case, regeneration falls back to using the existing stored schema, and a droppedCustomization warning is issued.
The service exposes public methods for diagnosis and regeneration. These are typically accessed through an administrative API.
diagnoseOperationDiagnoses the mapping readiness for a single operation.
| Parameter | Type | Description |
|---|---|---|
operationId | UUID | The unique identifier of the operation. |
Returns
A Map<String, Object> containing a detailed readiness report for the operation.
| Field | Type | Description |
|---|---|---|
serviceId | UUID | ID of the parent service. |
serviceKey | String | Key of the parent service. |
environment | String | Environment of the parent service. |
serviceVersionId | UUID | ID of the parent service version. |
serviceVersionStatus | String | Status of the service version (e.g., draft). |
serviceVersionActive | boolean | Whether the service version is active. |
mutableVersion | boolean | true if the operation's service version can be modified. |
operationId | UUID | ID of the operation. |
operationKey | String | Key of the operation. |
soapOperationName | String | The name attribute of the <operation> in the WSDL. |
mappingVersion | int | The version number of the active mapping. |
mappingGeneratedBy | String | The actor who generated the active mapping. |
requestMappingEngineVersion | String | The engine version used for the request mapping. |
responseMappingEngineVersion | String | The engine version used for the response mapping. |
requestContractChecksum | String | The contract checksum from the request mapping. |
responseContractChecksum | String | The contract checksum from the response mapping. |
requestStrategy | String | The strategy used for the request mapping (e.g., contract-json-to-soap). |
responseStrategy | String | The strategy used for the response mapping (e.g., contract-soap-to-json). |
readiness | String | AUTO_READY, AUTO_READY_WITH_WARNINGS, or MANUAL_REQUIRED. |
score | int | A readiness score from 0-100. |
warnings | List<String> | A list of non-critical issues found. |
errors | List<String> | A list of critical issues that require manual intervention. |
notes | List<String> | Informational notes, such as the presence of manual rules. |
Errors
IllegalArgumentException: If the operationId is not found.diagnoseServiceDiagnoses the mapping readiness for all operations within a service.
| Parameter | Type | Description |
|---|---|---|
serviceId | UUID | The unique identifier of the service. |
Returns
A Map<String, Object> containing a summary and a detailed report for each operation.
| Field | Type | Description |
|---|---|---|
serviceId | UUID | ID of the service. |
summary | Map<String, Object> | A map containing counts: operationCount, autoReady, autoReadyWithWarnings, manualRequired. |
operations | List<Map> | A list of diagnosis reports, with each entry matching the format returned by diagnoseOperation. |
Errors
IllegalArgumentException: If the serviceId is not found.regenerateOperationRegenerates the mapping for a single operation.
| Parameter | Type | Description |
|---|---|---|
operationId | UUID | The unique identifier of the operation to regenerate. |
actor | String | The identifier of the user or system performing the action. Defaults to system. |
Returns
An OperationMappingRecord object representing the newly created mapping.
Errors
IllegalArgumentException: If the operationId is not found.IllegalStateException: If the regeneration process fails. The exception message will contain the reason for failure.regenerateServiceRegenerates mappings for all mutable operations within a single service.
| Parameter | Type | Description |
|---|---|---|
serviceId | UUID | The unique identifier of the service to regenerate. |
actor | String | The identifier of the user or system performing the action. Defaults to system. |
Returns
A Map<String, Object> containing a summary of the regeneration task.
| Field | Type | Description |
|---|---|---|
serviceId | UUID | ID of the service. |
totalOperations | int | The total number of operations in the service. |
regeneratedCount | int | The number of operations that were successfully regenerated. |
immutableCount | int | The number of operations that were skipped because they are immutable. |
failedCount | int | The number of operations that failed to regenerate. |
regeneratedOperationIds | List<UUID> | A list of IDs for successfully regenerated operations. |
immutableOperationIds | List<UUID> | A list of IDs for skipped, immutable operations. |
failedOperations | List<Map> | A list of objects detailing each failure (operationId, operationKey, message). |
droppedCustomizations | List<Map> | Customizations that could not be preserved during regeneration. |
appliedAutoMatches | List<Map> | Fields that were successfully re-mapped after a name change. |
Errors
IllegalArgumentException: If the serviceId is not found.regenerateAllDraftServicesRegenerates mappings for all operations across all mutable (draft, non-active) service versions in the system.
| Parameter | Type | Description |
|---|---|---|
actor | String | The identifier of the user or system performing the action. Defaults to system. |
Returns
A Map<String, Object> containing a detailed report of the bulk regeneration task.
| Field | Type | Description |
|---|---|---|
totalServices | int | The total number of services with mutable versions that were processed. |
totalOperations | int | The total number of operations processed across all services. |
regeneratedCount | int | The total number of operations successfully regenerated. |
immutableCount | int | The total number of operations skipped (defensive check). |
failedCount | int | The total number of operations that failed to regenerate. |
droppedCustomizations | List<Map> | All customizations that could not be preserved across all operations. |
appliedAutoMatches | List<Map> | All fields that were successfully auto-matched across all operations. |
failedOperations | List<Map> | A list detailing each failed operation (operationId, operationKey, message). |
perService | List<Map> | A list of summary objects for each service that was processed. |
regenerateAllDraftServices{
"totalServices": 1,
"totalOperations": 2,
"regeneratedCount": 1,
"immutableCount": 0,
"failedCount": 1,
"droppedCustomizations": [
{
"operationId": "c2f8c0b5-...",
"operationKey": "updateInventory",
"xpath": "*",
"customizationKind": "schema-rederive",
"reason": "schema-rederive-degraded: request schema would lose 2 resolved type(s) (unresolved 0 -> 2); re-import the WSDL from its source so its imported schemas resolve"
}
],
"appliedAutoMatches": [
{
"operationId": "a1b2c3d4-...",
"operationKey": "getInventory",
"oldXpath": "/Envelope/Body/GetInventory/partId",
"newXpath": "/Envelope/Body/GetInventory/itemId",
"similarityScore": 0.95
}
],
"failedOperations": [
{
"operationId": "f9e8d7c6-...",
"operationKey": "submitOrder",
"message": "mapping regeneration failed"
}
],
"perService": [
{
"serviceId": "b1a2b3c4-...",
"serviceKey": "inventory-service",
"environment": "staging",
"operationCount": 2,
"regeneratedCount": 1,
"immutableCount": 0,
"failedCount": 1
}
]
}
IllegalStateException: Thrown by regenerateOperation when regeneration fails. The message indicates the cause.failedOperations list: In bulk regeneration (regenerateService, regenerateAllDraftServices), individual operation failures do not stop the entire process. Failures are caught, logged with code S2R-ADM-0483, and added to the failedOperations list in the response.During regeneration, the service may be unable to re-derive schemas from the source WSDL. This is reported in the droppedCustomizations list with a customizationKind of schema-rederive. Common reasons include:
no-wsdl-artifact-on-service-version: The service version has no associated WSDL artifact.wsdl-xml-not-stored: The WSDL XML was not stored during import (a behavior of older platform versions).operation-not-found-in-wsdl: The operation could not be located in the parsed WSDL.wsdl-parse-failed: The stored WSDL XML is invalid and could not be parsed.schema-rederive-degraded: The degradation guard was triggered. Re-parsing the WSDL would result in a lower-quality schema, so the existing schema was used instead. This may indicate the WSDL should be re-imported.persist-failed: The re-derived schema could not be saved to the database. A S2R-ADM-0481 warning is logged.The diagnoseOperation and diagnoseService functions may report the following issues in their warnings and errors lists:
Errors (result in MANUAL_REQUIRED status):
active operation mapping is missing: No mapping exists for the operation.request/response mapping does not include generated contract: The mapping is missing the machine-readable contract portion.mapping contractChecksum does not match current operation schema: The mapping was generated from a different version of the WSDL schema and is now out of sync.Warnings (result in AUTO_READY_WITH_WARNINGS status):
request/response contract snapshot is missing on operation schema: The stored schema is missing contract metadata.request/response strategy is not contract-json-to-soap/contract-soap-to-json: The mapping uses a legacy or non-standard transformation strategy.mappingEngineVersion is not contract-mapping-v2: The mapping was generated by an older engine.request/response mapping does not declare mappingEngineVersion: The engine version is missing from the mapping metadata.OperationMappingRepository: The repository service responsible for persistence logic, including regenerateActiveWithPreservation.WsdlParser: The component that parses WSDL and XSD documents.WsdlSchemaClosureResolver: The component that resolves xsd:import and wsdl:import statements.