davsclaus opened a new pull request, #3356:
URL: https://github.com/apache/camel-kamelets/pull/3356

   Follows the camel-cxf changes merged on Camel main for 4.24.0:
   
   - [CAMEL-27372](https://issues.apache.org/jira/browse/CAMEL-27372): a 
PAYLOAD consumer sends a String or DOM `<soap:Fault>` body, SOAP 1.1 or 1.2, as 
a fault with HTTP 500.
   - [CAMEL-27374](https://issues.apache.org/jira/browse/CAMEL-27374): a 
producer with `wsdlURL` and no address calls the `soap:address` of the WSDL.
   - [CAMEL-27373](https://issues.apache.org/jira/browse/CAMEL-27373): 
WS-Security UsernameToken options.
   - [CAMEL-27364](https://issues.apache.org/jira/browse/CAMEL-27364): the 
Camel CLI downloads the dependencies of a Kamelet when the route that uses it 
is added.
   
   ## Changes
   
   **soap-source**
   - The route can reply with a SOAP fault it builds itself, as XML text: a 
`<soap:Fault>`, or a SOAP 1.2 `Fault`. The client gets it as a SOAP fault, with 
its code, text and detail. This is documented and tested.
     - I kept it, because it comes for free with CAMEL-27372: the reply body is 
already passed as text.
     - It is no security risk: a fault is only sent to the client that made the 
request.
   - The SoapFault-header path no longer converts its fault to `CxfPayload`. 
The consumer now returns a Fault element given as text as a fault.
   - New options `wsSecurityUsername`, `wsSecurityPassword` (secret) and 
`wsSecurityPasswordType` (`Text`/`Digest`). When they are set, each request 
must carry a UsernameToken of that user, or it is refused with a SOAP fault 
before the route sees it.
     - The consumer accepts one user directly, so no map bean is needed.
     - `wsSecurityCredentials` and `wsSecurityCallbackHandler` are not exposed.
   
   **soap-action**
   - `address` is optional. Without it, the address that the WSDL gives for the 
port is called. The template uses `cxf://{{?address}}?wsdlURL=...`.
   - New options `wsSecurityUsername`, `wsSecurityPassword` (secret) and 
`wsSecurityPasswordType`, mapped to the camel-cxf options of the same names.
   - "Good to know" no longer says that a route catching `SoapFault` needs 
`--dep=camel:cxf-soap`. I checked with `camel run` and no `--dep`: a `doCatch` 
on `org.apache.cxf.binding.soap.SoapFault` after soap-action catches `Order 404 
not found`.
   - "Good to know" says that a refused UsernameToken gives a fault with the 
code `SecurityError`.
   
   ## The cxf-rt-ws-security dependency: a design choice to review
   
   The WS-Security options need `org.apache.cxf:cxf-rt-ws-security`. No 
`camel:` dependency brings it: camel-cxf-soap has it as an optional dependency 
only, with opensaml excluded. The Camel CLI does not download it either.
   
   I did **not** pin `mvn:org.apache.cxf:cxf-rt-ws-security:4.2.4` in the 
Kamelets:
   
   - Every soap-source and soap-action user would download it, with opensaml, 
which camel-cxf-soap excludes. A Kamelet `mvn:` dependency cannot exclude 
transitive dependencies.
   - The pinned version would drift from the runtime's CXF. Camel Quarkus also 
ships its own CXF.
   
   The Kamelets document the dependency instead: `camel run 
--dep=mvn:org.apache.cxf:cxf-rt-ws-security:4.2.4` with Camel 4.24, the 
`cxf-version` of Camel main. Without it, the integration fails to start with 
`The wsSecurity options need the org.apache.cxf:cxf-rt-ws-security dependency 
on the classpath`; I checked that by hand. The alternative is to leave 
WS-Security for a later PR, once Camel downloads the jar by itself.
   
   ## Tests
   
   Local `SoapIT`: **3 tests, 3 passed**.
   
   - **`soap-front-backend`, new cases:**
     - soap-action with no `address` and `wsdlURL` set to 
`http://localhost:<port>/orders?wsdl`, the WSDL that soap-source serves. The 
call reaches the backend at the address that WSDL gives.
     - The backend route answers order 409 with a `<soap:Fault>` it builds as 
text. The client gets HTTP 500 and the fault, with its detail.
   - **`soap-soap12`, new case:** a SOAP 1.2 `env:Fault` built as text gives 
HTTP 500 with `env:Sender` and its reason.
   - **New `soap-wssec` test:** soap-source requires a UsernameToken of `alice` 
(password `s3cr&t+pw`). It is run with 
`--dep=mvn:org.apache.cxf:cxf-rt-ws-security:4.2.4`.
   
     | Request | Result |
     |---|---|
     | The right password as `Text` | Passes; the route sees 
`CamelAuthentication`. |
     | `Digest`, to a service that requires `Digest` | Passes. |
     | A wrong password | `SoapFault=A security error was encountered when 
verifying the message`, code `SecurityError`. |
     | `Text` to the `Digest` service | Refused. |
     | No token | HTTP 500. |
   
   `camel generate wsdl orders.wsdl --json` (CAMEL-27376) lists `serviceName`, 
`portName`, `wsdlURL`, `address` and `defaultOperationNamespace`. The Kamelet 
options map to these; `operation` and `operationNamespace` are the Kamelet's 
names for `defaultOperationName` and `defaultOperationNamespace`. No mismatch.
   
   ## Upgrade note
   
   ```
   * `soap-action`: `address` is optional (the address in the WSDL is called), 
new options `wsSecurityUsername`, `wsSecurityPassword` and 
`wsSecurityPasswordType` for a WS-Security UsernameToken (they need 
`--dep=mvn:org.apache.cxf:cxf-rt-ws-security:<CXF version of Camel>`), and a 
route no longer needs `--dep=camel:cxf-soap` to catch `SoapFault`. 
`soap-source`: the same three options to require a UsernameToken, and a reply 
that is a `<soap:Fault>` as XML text is sent as a SOAP fault (HTTP 500).
   ```
   
   _Claude Code on behalf of Claus Ibsen_
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   
   https://claude.ai/code/session_016Y4dDmBDsSWV117kccuNf9
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to