rest-keycloak-soap-jms: encode JSON responses with the REST binding - #560
Merged
Conversation
The order response was assembled with String.format, interpolating the
message returned by the SOAP service straight into a JSON template. A
quote or backslash in that message produces malformed JSON. Build an
OrderResponse instead and let the existing json binding mode encode it.
The Keycloak admin error handler embedded ${exception.message} in a
constant(), so the placeholder was emitted literally rather than
resolved. Return a static message and keep the exception detail in the
log, which now runs at ERROR level.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
jamesnetherton
deleted the
rest-keycloak-soap-jms-json-encoding-and-error-handling
branch
August 10, 2026 16:25
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
RestOrderRouteassembled its JSON response withString.format, interpolating the message returned by the SOAP service directly into a JSON template. Any quote or backslash in that message yields malformed JSON. This replaces it with anOrderResponsePOJO encoded by the route's existingRestBindingMode.jsonbinding.The explicit
Content-Typeheader is kept — after the CXF call the exchange carriestext/xml, and the REST binding will not marshal to JSON without it.KeycloakAdminRoute's error handler embedded${exception.message}inside aconstant(), so the placeholder was emitted literally instead of being resolved. Rather than switch tosimple()— which would turn a latent bug into a genuine information leak — the response is now a static message and the exception detail stays in the log, which has been raised toERROR.The success-path test asserted only that the response string contained
successandtrue, which passes on malformed JSON. It now asserts the parsed JSON fields, so the response has to be well-formed.Verified with
mvn clean verify -Dnative.Claude Code on behalf of James Netherton