davsclaus opened a new issue, #144:
URL: https://github.com/apache/camel-jbang-examples/issues/144

   The examples have no SOAP web service yet. Camel 4.24 adds two Kamelets for 
SOAP, built on camel-cxf. They need only the WSDL: no Java classes are 
generated from it (apache/camel-kamelets#3335, apache/camel-kamelets#3341).
   
   - `soap-source` serves a SOAP service from a WSDL file and answers each call 
with the reply of the route. It can stand in front of a legacy service.
   - `soap-action` calls one operation of an existing SOAP service for each 
message, and gives back the response.
   
   The body is the XML of the operation's element, such as `<getOrder 
xmlns="...">`. Both Kamelets are Preview. They come in camel-kamelets 4.24.0, 
together with Camel 4.24.0.
   
   Proposed examples, WSDL-first, with the shop's orders (ORD-1001, ORD-1002, 
ORD-1003). The WSDL is the contract, so they can go in `contracts/`, next to 
`openapi-server` and `openapi-client`:
   
   1. **A SOAP facade in front of a legacy system.** This is the main use case. 
`soap-source` serves the shop's order service from its WSDL, so the old SOAP 
clients keep working. The route calls a REST/JSON service behind it and maps 
the answer back into the SOAP response. An unknown order gets the fault that 
the WSDL declares: the route sets the headers `SoapFault` and `SoapFaultCode`, 
and the body is the fault element.
   2. **Calling a legacy SOAP service from a route.** `soap-action` calls 
`getOrder` for each order, and `xj-identity-action` turns the XML answer into 
JSON. With `faultAsBody: true`, a fault of the service does not fail the 
message: the route gets the detail of the fault and can pass it on. The legacy 
service is a second route with `soap-source` in the same example, so no 
external SOAP server is needed.
   
   Each example comes with a Citrus YAML test, run with `camel test run`. The 
camel-kamelets test `soap-front-backend.citrus.it.yaml` (in 
`tests/camel-kamelets-itest/src/test/resources/soap/`) shows how: it starts 
both routes with `camel: cli: run:`, then posts a SOAP envelope over HTTP.
   
   Good to know:
   - `soap-source` has no login. The README should say to protect its address.
   - A request with a DOCTYPE is refused. While `schemaValidation` is on (the 
default), a request or a reply that does not match the XML schema of the WSDL 
is refused too.
   - When the route fails, the client gets a SOAP fault with the text `Exchange 
processing failed`, which does not say why.
   - A route that catches the fault of `soap-action` by its class name, 
`org.apache.cxf.binding.soap.SoapFault`, needs the dependency `camel:cxf-soap`.
   - SOAP 1.2 works as well, as the WSDL says. It can be a "Try changing" item.
   - `camel generate wsdl` (CAMEL-27376 (camel generate wsdl), new in 4.24) 
lists the operations of a WSDL, which can help in "Build it step by step".
   
   Later, when the Kamelets support them: a JSON body that uses the XML schema 
of the WSDL (CAMEL-27375 (xsdJson data format)), and WS-Security UsernameToken 
(CAMEL-27373 (WS-Security UsernameToken options)). Both are merged in Camel; 
the Kamelet changes are in progress.
   
   The examples CI runs the released Camel, so these examples can be merged 
when Camel 4.24.0 is out.
   
   _Claude Code on behalf of davsclaus_
   


-- 
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