Loading…
Loading…
Provides read access to learned SOAP field data, including value samples and encoding fingerprints, captured from live traffic for a specific service.
The LearnedFieldValueRepository provides read access to data about individual SOAP message fields learned from captured traffic. This component is primarily used by the WSDL Onboarding user interface to auto-suggest per-field encodings based on real-world data observed for a service.
It aggregates field data from two distinct sources:
s2r_f5_learned_field_value table).s2r_generic_learned_field_value table).The repository queries these sources for a specified service, identified by its service_backend_key, and returns a consolidated list of learned fields, including their data fingerprints, usage counts, and optionally, a sample of observed values.
The repository's primary function is to query, merge, and rank learned field data from multiple underlying database tables. The process is orchestrated by the findByServiceBackendKey method.
flowchart TD
subgraph "Learned Field Query Process"
A[Input: service_backend_key, optional filters] --> B{Construct Query};
B --> C[Query F5 Gateway Data<br/>(s2r_f5_learned_field_value)];
B --> D[Query Generic Gateway Data<br/>(s2r_generic_learned_field_value)];
C --> E[Union Results];
D --> E;
E --> F[Deduplicate by Field Identity];
F --> G[Sort and Limit Results];
G --> H[Return List of Learned Fields];
endQuerying Data Sources: The repository constructs two parallel SQL queries, one for the s2r_f5_learned_field_value table and one for the s2r_generic_learned_field_value table. Both queries are filtered by the service_backend_key of the service in question. Additional optional filters for soap_operation_name and direction (request/response) can be applied to narrow the scope.
Tenant Scoping: Although the underlying tables have row-level security (RLS) policies, the connection used by this repository is the table owner, which bypasses those policies. To ensure strict tenant data isolation, the query explicitly includes a predicate (TENANT_SCOPE_SQL) to filter results for the current tenant.
Merging Results: The results from the F5 and generic gateway tables are combined using a UNION ALL operation. A source column is added to each record to indicate its origin (f5 or the specific gateway type).
Deduplication: A service backend may be observed through both an F5 and a generic gateway, resulting in duplicate entries for the same logical field (identified by soap_operation_name, direction, and field_xpath). The combined result set is deduplicated using DISTINCT ON. The query is ordered by seen_count desc and last_seen_at desc before deduplication, which ensures that for any given field, the record with the highest observation count is the one that is kept.
Final Result Set: The final, deduplicated list of fields is ordered by seen_count in descending order, so the most frequently observed fields appear first. The result set is limited to a maximum of 500 fields.
IMPORTANT
The includeValueSamples parameter controls whether the valueSamplesJson field in the response contains actual data samples. When set to false, the query explicitly returns NULL for this field, preventing the exposure of potentially sensitive data to callers who do not require it.
The repository exposes a single public method for querying learned field data.
This method retrieves all learned fields for a discovered service, identified by its service_backend_key. Results are aggregated from both F5 and generic gateway traffic sources.
| Name | Type | Description |
|---|---|---|
serviceBackendKey | String | Required. The canonical key identifying the service. |
operationName | String | An optional SOAP operation name to scope the search. If null or blank, fields from all operations are returned. |
direction | String | An optional direction to scope the search (e.g., "request" or "response"). If null or blank, fields from both directions are returned. |
includeValueSamples | boolean | If true, the valueSamplesJson field will contain observed value samples. If false, it will be null. |
Returns a List<Map<String, Object>> where each map represents a single learned field. The list is ordered by seenCount descending and is limited to 500 entries.
Each map in the returned list contains the following key-value pairs.
| Key | Type | Description |
|---|---|---|
serviceBackendKey | String | The service backend key this field belongs to. |
operationName | String | The name of the SOAP operation this field was observed in. |
direction | String | The direction of the message containing the field (e.g., "request", "response"). |
xpath | String | The full XPath of the field within the SOAP body. |
localName | String | The local XML element name of the field. |
encodingFingerprint | String | A fingerprint representing the data type and encoding characteristics observed for the field's values. |
containsHebrew | boolean | true if any observed value for this field contained Hebrew characters. |
valueSamplesJson | String | A JSON string containing a sample of observed values. This will be null if the includeValueSamples parameter was false. |
valueDistinctCount | int | The number of distinct values observed for this field. |
seenCount | long | The total number of times this field has been observed in traffic. |
firstSeenAt | Timestamp | The timestamp when this field was first observed. |
lastSeenAt | Timestamp | The timestamp when this field was most recently observed. |
source | String | The source of the data. This will be 'f5' for F5 gateway data or the gateway type (e.g., 'generic') for other sources. |