Skip to content

ClassCastException when receiving encrypted SOAP message with whitespace before payload #1575

@jpwilhelms

Description

@jpwilhelms

Bug Report

When the server receives an encrypted SOAP message that contains whitespace immediately before the payload, it throws a ClassCastException.

Steps to Reproduce

  1. Send an encrypted SOAP message to the server with whitespace characters (such as spaces or newlines) just before the payload element.
  2. Observe the server behavior.

Expected Behavior

The server should correctly process the encrypted SOAP message, ignoring any whitespace before the payload.

Actual Behavior

The server throws a java.lang.ClassCastException: class com.sun.org.apache.xerces.internal.dom.TextImpl cannot be cast to class jakarta.xml.soap.Node (com.sun.org.apache.xerces.internal.dom.TextImpl is in module java.xml of loader 'bootstrap'; jakarta.xml.soap.Node is in unnamed module of loader 'app') when whitespace precedes the payload in an encrypted message.

Additional Context

  • I have prepared a minimal sample application for reproducing the issue: demo

Environment

  • Spring WS version: 4.0.13
  • JDK version: 21.0.5

Thank you.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions