Skip to content

WSDL Validation: Resolution of embedded schemas, ns aware filter of soap elements…#3071

Merged
rrayst merged 2 commits into
masterfrom
wsdl-validation-import-embedded
Jul 10, 2026
Merged

WSDL Validation: Resolution of embedded schemas, ns aware filter of soap elements…#3071
rrayst merged 2 commits into
masterfrom
wsdl-validation-import-embedded

Conversation

@predic8

@predic8 predic8 commented Jul 8, 2026

Copy link
Copy Markdown
Member

…, logging

Summary by CodeRabbit

  • Bug Fixes
    • Resolved spurious schema-validation errors when a SOAP request matches one of multiple embedded schemas, with failure reported once only when none match.
    • Improved SOAP body extraction to match the <Body> element by SOAP namespace (preserving non-SOAP elements named Body).
    • Fixed embedded WSDL/XSD schema resolution, including namespace-only <xsd:import> across embedded schemas.
  • Improvements
    • Validation logging is more structured and less noisy (collects errors and logs debug details only as needed).
  • Tests
    • Added coverage for multi-schema logging behavior, SOAP body filtering, and cross-embedded schema import resolution.

@coderabbitai

coderabbitai Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: b8db856d-ec92-493a-9cef-4ae5d8cbee3f

📥 Commits

Reviewing files that changed from the base of the PR and between c329f7e and b818393.

📒 Files selected for processing (1)
  • core/src/test/java/com/predic8/membrane/core/interceptor/schemavalidation/SOAPXMLFilterTest.java

📝 Walkthrough

Walkthrough

Schema validation now consolidates embedded-schema errors into one failure path, WSDL import resolution handles namespace-only references between embedded schemas, and SOAP body extraction matches SOAP namespaces while preserving non-SOAP Body elements. Tests, a fixture, and release notes were added.

Changes

Schema/WSDL validation and SOAP parsing fixes

Layer / File(s) Summary
Consolidated schema validation logging
core/src/main/java/com/predic8/membrane/core/interceptor/schemavalidation/SchemaValidatorErrorHandler.java, core/src/main/java/com/predic8/membrane/core/interceptor/schemavalidation/AbstractXMLSchemaValidator.java, core/src/test/java/com/predic8/membrane/core/interceptor/schemavalidation/MultiSchemaValidationLoggingTest.java, core/src/test/resources/ws/import/second-schema-match.wsdl
Parse exceptions are stored and reported later, schema validation logs one consolidated failure when no embedded schema matches, and new tests/fixture cover the multi-schema case.
WSDL embedded schema resolution
core/src/main/java/com/predic8/membrane/core/interceptor/schemavalidation/WSDLValidator.java, core/src/test/java/com/predic8/membrane/core/ws/WSDLIncludeImportTest.java
Namespace-only embedded schema imports are resolved through an overridable resource resolver, and validator initialization is covered by a new import test.
SOAP body namespace matching
core/src/main/java/com/predic8/membrane/core/interceptor/schemavalidation/SOAPXMLFilter.java, core/src/main/java/com/predic8/membrane/core/util/SOAPUtil.java, core/src/test/java/com/predic8/membrane/core/interceptor/schemavalidation/SOAPXMLFilterTest.java
SOAP body detection now checks namespace plus local name, SOAP parse failures return immediately, and tests cover SOAP 1.1/1.2 body extraction.
Release notes
distribution/release-notes/7.3.1.md
Adds 7.3.1 notes for the logging, resolver, and SOAP body changes.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Suggested reviewers: rrayst

Poem

A rabbit hopped where schemas bloom,
And cleared the noisy error room. 🐇
SOAP Body stayed, a neat surprise,
While imports matched by namespace ties.
Hop hop — the logs now speak just once!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main changes: embedded schema resolution and namespace-aware SOAP element filtering.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch wsdl-validation-import-embedded

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
core/src/test/java/com/predic8/membrane/core/interceptor/schemavalidation/SOAPXMLFilterTest.java (1)

73-76: 🔒 Security & Privacy | 🔵 Trivial | 💤 Low value

Consider enabling secure processing on TransformerFactory.

Static analysis flagged TransformerFactory.newInstance().newTransformer() without secure processing (CWE-611). While the input is controlled test data so the actual risk is negligible, enabling secure processing is a simple best practice even in tests to avoid normalizing insecure XML parsing patterns.

🔒️ Optional hardening
     private static String filterSoapBody(String soap) throws Exception {
-        Transformer t = TransformerFactory.newInstance().newTransformer();
+        TransformerFactory tf = TransformerFactory.newInstance();
+        tf.setFeature(javax.xml.XMLConstants.FEATURE_SECURE_PROCESSING, true);
+        Transformer t = tf.newTransformer();
         StringWriter sw = new StringWriter();
         t.transform(MessageUtil.getSOAPBody(new ByteArrayInputStream(soap.getBytes(UTF_8))), new StreamResult(sw));
         return sw.toString();
     }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@core/src/test/java/com/predic8/membrane/core/interceptor/schemavalidation/SOAPXMLFilterTest.java`
around lines 73 - 76, The SOAP body filtering helper uses
TransformerFactory.newInstance().newTransformer() without secure processing, so
update filterSoapBody to configure the TransformerFactory with secure processing
before creating the Transformer. Keep the change localized to the filterSoapBody
method in SOAPXMLFilterTest, and ensure the TransformerFactory setup explicitly
enables the secure XML processing feature rather than using the default factory
behavior.

Source: Linters/SAST tools

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In
`@core/src/test/java/com/predic8/membrane/core/interceptor/schemavalidation/SOAPXMLFilterTest.java`:
- Around line 73-76: The SOAP body filtering helper uses
TransformerFactory.newInstance().newTransformer() without secure processing, so
update filterSoapBody to configure the TransformerFactory with secure processing
before creating the Transformer. Keep the change localized to the filterSoapBody
method in SOAPXMLFilterTest, and ensure the TransformerFactory setup explicitly
enables the secure XML processing feature rather than using the default factory
behavior.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: caf5ea40-743d-45fa-9330-4ec21deb9887

📥 Commits

Reviewing files that changed from the base of the PR and between d6d92d4 and c329f7e.

📒 Files selected for processing (10)
  • core/src/main/java/com/predic8/membrane/core/interceptor/schemavalidation/AbstractXMLSchemaValidator.java
  • core/src/main/java/com/predic8/membrane/core/interceptor/schemavalidation/SOAPXMLFilter.java
  • core/src/main/java/com/predic8/membrane/core/interceptor/schemavalidation/SchemaValidatorErrorHandler.java
  • core/src/main/java/com/predic8/membrane/core/interceptor/schemavalidation/WSDLValidator.java
  • core/src/main/java/com/predic8/membrane/core/util/SOAPUtil.java
  • core/src/test/java/com/predic8/membrane/core/interceptor/schemavalidation/MultiSchemaValidationLoggingTest.java
  • core/src/test/java/com/predic8/membrane/core/interceptor/schemavalidation/SOAPXMLFilterTest.java
  • core/src/test/java/com/predic8/membrane/core/ws/WSDLIncludeImportTest.java
  • core/src/test/resources/ws/import/second-schema-match.wsdl
  • distribution/release-notes/7.3.1.md

@predic8 predic8 requested a review from rrayst July 8, 2026 09:02
@rrayst rrayst merged commit 964ec2f into master Jul 10, 2026
5 checks passed
@rrayst rrayst deleted the wsdl-validation-import-embedded branch July 10, 2026 10:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants