Fix rest-cxf example: use CamelCxfOperationName for dynamic bean dispatch - #206
Open
Croway wants to merge 2 commits into
Open
Fix rest-cxf example: use CamelCxfOperationName for dynamic bean dispatch#206Croway wants to merge 2 commits into
Croway wants to merge 2 commits into
Conversation
…dispatch
CamelRouter routed on ${header.operationName}, a header CXF-RS never sets;
DefaultCxfRsBinding populates CamelCxfOperationName instead, so the header
resolved empty and every GET/PUT hit MethodNotFoundException (500). Only
the bean-validation error path worked, since it short-circuits before the
dynamic dispatch.
Use ${header.CamelCxfOperationName}, and switch to recipientList to match
the idiom documented in the cxfrs component docs and already used by the
sibling soap-cxf example, instead of toD.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JvQJNT1UYzqUm5HQtkL6Nu
recipientList is designed for multicasting to potentially several recipients; here there is exactly one computed destination per exchange, which is exactly what toD is for. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JvQJNT1UYzqUm5HQtkL6Nu
Open
6 tasks
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.
Summary
CamelRouterin therest-cxfexample dispatched on${header.operationName}, a header that CXF-RS never sets.DefaultCxfRsBindingactually populatesCamelCxfOperationNamefor every cxfrs request regardless of binding style, so the header resolved empty and every GET/PUT hitbean:userServiceImpl?method=with a blank method name, throwingMethodNotFoundException(500). Only the bean-validation error path worked, since it short-circuits before the dynamic dispatch. This is a pre-existing bug, not a regression from any recent bump.${header.CamelCxfOperationName}, matching what the siblingsoap-cxfexample already does correctly.toD(rather than switching torecipientList) since there is exactly one computed destination per exchange here —toDis the EIP built for that case, whereasrecipientListis designed for multicasting to potentially several recipients.Test plan
mvn -pl rest-cxf -am packagemvn spring-boot:run) and exercised all documented endpoints:GET /services/api/user→ 200, list of usersGET /services/api/user/1→ 200, single userPUT /services/api/user(valid payload) → 201PUT /services/api/user(invalid payload) → 400 with validation message (already worked before, still works)🤖 Generated with Claude Code