Commit 784189e
CAMEL-23909: Fix flaky CxfConsumerPayLoadFaultMessageTest (#24426)
* CAMEL-23909: Fix flaky CxfConsumerPayLoadFaultMessageTest
Enhance CxfConsumer.extractFromBody() to detect CxfPayload bodies
containing raw SOAP Fault XML elements and convert them to proper
SoapFault exceptions. Previously, only bodies that were direct
Throwable instances were recognized as faults. When a route set a
CxfPayload containing a <soap:Fault> element directly on the message
body (as in CxfConsumerPayLoadFaultMessageTest), the fault was not
detected and went through CXF's normal response serialization path
instead of the fault handling path, leading to intermittent failures.
The fix adds extractFaultFromPayload() which checks for a single
Element body with localName "Fault" in SOAP 1.1 or 1.2 namespace,
extracts faultcode/faultstring/detail, and constructs a SoapFault
that CXF can process through its standard fault handling pipeline.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* CAMEL-23909: Fix namespace lookup in parseFaultCode
Look up the namespace prefix from the codeElement rather than
faultElement so that namespace declarations on the <faultcode>/<Code>
element itself are also visible. lookupNamespaceURI walks up the tree,
so declarations on ancestor elements (including <Fault>) are still
found.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>1 parent 105f362 commit 784189e
1 file changed
Lines changed: 84 additions & 0 deletions
File tree
- components/camel-cxf/camel-cxf-soap/src/main/java/org/apache/camel/component/cxf/jaxws
Lines changed: 84 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| 21 | + | |
21 | 22 | | |
22 | 23 | | |
23 | 24 | | |
24 | 25 | | |
| 26 | + | |
| 27 | + | |
25 | 28 | | |
| 29 | + | |
| 30 | + | |
26 | 31 | | |
27 | 32 | | |
28 | 33 | | |
29 | 34 | | |
30 | 35 | | |
31 | 36 | | |
32 | 37 | | |
| 38 | + | |
33 | 39 | | |
34 | 40 | | |
35 | 41 | | |
36 | 42 | | |
37 | 43 | | |
| 44 | + | |
38 | 45 | | |
39 | 46 | | |
40 | 47 | | |
| |||
402 | 409 | | |
403 | 410 | | |
404 | 411 | | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
405 | 415 | | |
406 | 416 | | |
407 | 417 | | |
408 | 418 | | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
409 | 493 | | |
410 | 494 | | |
0 commit comments