Skip to content

Adds opt-in Content-Type propagation to SOAPDecoder - #3698

Open
RahimovShaxriyor wants to merge 1 commit into
OpenFeign:masterfrom
RahimovShaxriyor:fix/issue-1732-soap-content-type
Open

RahimovShaxriyor wants to merge 1 commit into
OpenFeign:masterfrom
RahimovShaxriyor:fix/issue-1732-soap-content-type

Conversation

@RahimovShaxriyor

Copy link
Copy Markdown

Summary

Adds SOAPDecoder.Builder#propagateContentType(), which passes the response's Content-Type header to SAAJ's MessageFactory. Disabled by default, as suggested by @kdavisk6 in #1732. Applied to both feign-soap and feign-soap-jakarta, with a README note.

Root Cause

SOAPDecoder calls MessageFactory.createMessage(null, body). Without MIME headers SAAJ assumes a plain envelope, so an MTOM/XOP (multipart/related) response fails with Unable to create envelope from given source, and DYNAMIC_SOAP_PROTOCOL fails with an NPE.

Tests

New tests in SOAPCodecTest (both modules):

  • multipart/XOP response decodes with propagation enabled;
  • the same response still fails by default (behavior unchanged);
  • SOAP 1.2 with DYNAMIC_SOAP_PROTOCOL and application/soap+xml;
  • propagation enabled but no Content-Type header still decodes.

The first and third fail without the change. mvn -Pdev -pl soap,soap-jakarta -am clean install passes locally.

Out of scope: resolving xop:Include binary parts (an AttachmentUnmarshaller, mentioned in the issue comments).

Closes #1732

🤖 Generated with Claude Code

`SOAPDecoder` created the `SOAPMessage` without MIME headers, so SAAJ
always assumed a plain SOAP envelope. Responses such as MTOM/XOP
(`multipart/related`) failed with "Unable to create envelope", and
`DYNAMIC_SOAP_PROTOCOL` could not be used at all.

`SOAPDecoder.Builder#propagateContentType()` passes the response's
`Content-Type` header to the `MessageFactory`. It is disabled by default
to keep the current behavior, as suggested in the issue. Applied to both
`feign-soap` and `feign-soap-jakarta`.

Fixes OpenFeign#1732

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.

Enhance SoapDecoder by using Content Type from Response as Mime Type

1 participant