Loading…
Loading…
Describes the SOAP payload parser that extracts and analyzes leaf field values from SOAP requests and responses to detect encoding formats and special
The SoapPayloadExtractor is a utility for parsing SOAP XML payloads from either requests or responses. Its primary function is to traverse a SOAP document, identify all text-bearing leaf elements, and extract their values into a structured format.
This component solves the problem of understanding the data types and encodings used within SOAP traffic. It produces a flat list of LeafField records. Each record contains the element's simplified XPath, its local name, its trimmed text value, a detected encoding fingerprint, and a flag indicating the presence of Hebrew characters.
The SoapPayloadExtractor is called by the traffic learning service to analyze captured traffic. The extracted field information is used to populate a data store that provides insights and hints within the API management user interface, particularly during service onboarding and configuration.
NOTE
The scope of this component is limited to detection. It generates an encoding fingerprint for each field, but it does not perform any re-encoding of the data itself. The source indicates that runtime re-encoding is a deferred action handled outside of this component.
The extraction process is initiated by the static method extractLeafFields, which takes a raw XML payload string and a processing limit as input. The process follows these steps:
null or consists only of whitespace. If so, it immediately returns an empty list.XMLConstants.FEATURE_SECURE_PROCESSING is enabled.http://apache.org/xml/features/disallow-doctype-decl is enabled to block DOCTYPE declarations.http://xml.org/sax/features/external-general-entities is disabled.http://xml.org/sax/features/external-parameter-entities is disabled.XInclude processing is disabled.Document. Any parsing error is caught, and the method returns an empty list. This design ensures that malformed traffic does not crash the data ingestion pipeline./Envelope/Body/MyOperation).U+0590 through U+05FF).encodingFingerprint by applying a series of pattern checks.LeafField record is created for each qualifying element and added to a list. The process stops if the number of extracted fields reaches the maxLeaves limit.LeafField records is returned.The following diagram illustrates the data flow:
flowchart TD
A[Input: SOAP XML Payload] --> B{Payload Valid?};
B -- No --> X[Output: Empty List];
B -- Yes --> C[Securely Parse XML to DOM];
C -- On Error --> X;
C -- Success --> D[Walk DOM Tree];
subgraph "For Each Leaf Element with Text"
E[Extract Text Value] --> F[Analyze Value for Hebrew & Encoding];
F --> G[Create LeafField Record];
end
D --> E;
G --> H{Field Limit Reached?};
H -- No --> D;
H -- Yes --> I[Stop Processing];
I --> J[Output: List of LeafField Records];
D -- Walk Complete --> J;The component exposes a single static method for extracting fields.
extractLeafFieldsWalks a SOAP envelope and collects every leaf element that contains non-blank text content.
static List<LeafField> extractLeafFields(String payload, int maxLeaves)
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
payload | String | Yes | — | The raw SOAP XML payload as a string. Can be a request or a response body. |
maxLeaves | int | No | 256 | A soft limit on the number of leaf fields to extract. This protects against pathologically large documents. If 0 or negative, it defaults to 256. |
A java.util.List of LeafField records. The list will be empty if the input payload is null, blank, or if any XML parsing error occurs.
LeafField RecordThe extractLeafFields method returns a list of LeafField records, each representing a single extracted value.
| Field | Type | Description |
|---|---|---|
xpath | String | A simplified, slash-separated path from the root to the element, using local element names. |
localName | String | The local name of the XML element, without any namespace prefix. |
value | String | The trimmed text content of the element. |
encodingFingerprint | String | A string token identifying the detected encoding or format of the value. See Encoding Fingerprints. |
containsHebrew | boolean | true if the value contains any characters in the Hebrew Unicode block (U+0590 to U+05FF). |
The encodingFingerprint is a string that categorizes the content of a field's value. The extractor checks for these categories in a specific order, and the first one to match determines the fingerprint.
| Fingerprint | Description |
|---|---|
clear-utf8-hebrew | The value contains one or more characters from the Hebrew Unicode block (U+0590–U+05FF). This is the highest priority fingerprint. |
html-entities | The value contains HTML entity sequences, such as א, #x5D0;, or &. This is often used to encode non-ASCII characters. |
url-encoded | The value contains percent-encoded sequences, such as %D7%90. |
base64 | The entire value is a valid Base64-encoded string. To qualify, the value must: be at least 16 characters long, consist only of Base64 characters (A-Z, a-z, 0-9, +, /), have a length that is a multiple of 4, and have valid padding (= characters). |
utf8-hebrew-as-latin1 | The value contains character sequences indicative of UTF-8 encoded Hebrew text that was incorrectly decoded as Latin-1 or Windows-1252. This results in two-character mojibake sequences like × followed by another character. This is a diagnostic fingerprint. |
plain | The fallback category for any value that does not match the above criteria. This includes plain ASCII text, numbers, GUIDs, dates, and text in languages other than Hebrew. |
The extractLeafFields method is designed to fail silently by returning an empty list rather than throwing an exception. An empty list will be returned under the following conditions:
payload string is null.payload string is blank (empty or contains only whitespace).This behavior prevents malformed traffic from disrupting the data ingestion service.
If the returned list of fields is shorter than expected for a large document, check the maxLeaves parameter. The extraction process stops once the number of collected fields reaches this limit, which defaults to 256.
SoapPayloadExtractor. It uses the extracted field data to learn the structure and data formats of APIs from observed traffic.