SOAP Source
Provided by: "Apache Software Foundation"
Support Level for this Kamelet is: "Preview"
Serves a SOAP web service described by a WSDL file, and answers each call with the reply of the route.
Use it to keep existing SOAP clients working while the systems behind the service are replaced: the route gets each call and can call REST services or other systems to answer it. No Java code is generated from the WSDL. To call a SOAP service, use soap-action.
Output: the body is the content of the SOAP Body of the request as XML text: the request element of the operation, such as <getOrder xmlns="http://example.com/orders"><orderId>7</orderId></getOrder>. The header CamelCxfOperationName is the name of the operation, such as getOrder, and CamelCxfOperationNamespace its namespace. The HTTP headers of the request, such as User-Agent, are headers too.
The reply of the route, as XML text, is the content of the SOAP Body of the response: the response element of the operation, such as <getOrderResponse xmlns="http://example.com/orders">…</getOrderResponse>. To answer with a SOAP fault, the route sets the header SoapFault to the text of the fault, and SoapFaultCode to Client when the request was wrong (Sender with SOAP 1.2; otherwise the code is Server, or Receiver); the body, if any, is the content of the detail of the fault as XML text, such as the fault element the WSDL declares. This is what soap-action gives with faultAsBody, so a fault of a called service can be passed on. The route can also reply with the SOAP fault itself, as XML text, such as <soap:Fault xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><faultcode>soap:Client</faultcode><faultstring>No such order</faultstring></soap:Fault>, or a Fault of SOAP 1.2: the client gets it as a SOAP fault, with its code, text and detail. When the route fails, the client gets a SOAP fault with the text Exchange processing failed, which does not say why. The headers of the reply are not sent back to the client.
Good to know: the service is served at address, its WSDL at address followed by ?wsdl, with SOAP 1.1 or 1.2 as the WSDL says. A request or a reply that does not match the XML schema of the WSDL is refused with a SOAP fault, unless schemaValidation is false, and so is a request for an operation the WSDL does not have, and a request with a DOCTYPE. There is no login unless wsSecurityUsername and wsSecurityPassword are set, which require a WS-Security UsernameToken in each request: the integration then needs the jar org.apache.cxf:cxf-rt-ws-security of the CXF version that Camel uses, such as camel run --dep=mvn:org.apache.cxf:cxf-rt-ws-security:4.2.4 with Camel 4.24, or it fails to start with a message that says so. Protect the address with your network too. To work with JSON, turn the body into JSON with xj-identity-action, and build the reply as XML.
Configuration Options
The following table summarizes the configuration options available for the soap-source Kamelet:
| Property | Name | Description | Type | Default | Example |
|---|---|---|---|---|---|
Address | Required The URL to serve the SOAP service at. Use | string | http://0.0.0.0:8080/orders | ||
WSDL Location | Required Where to read the WSDL file from, which describes the operations and their XML schema. | string | classpath:orders.wsdl | ||
Log Messages | Whether to write each SOAP request and response to the log. Do not turn it on when the messages hold personal data or secrets. | boolean | false | ||
Port Name | The port of the service to serve, as | string | {http://example.com/orders}OrderPort | ||
Published URL | The URL that the WSDL served at | string | https://orders.example.com/orders | ||
Schema Validation | Whether to refuse a request, and a reply of the route, that does not match the XML schema of the WSDL. | boolean | true | ||
Service Name | The service of the WSDL to serve, as | string | {http://example.com/orders}OrderService | ||
WS-Security Password | The password of | string | |||
WS-Security Password Type | How the UsernameToken must carry the password. Enum values: * Text * Digest | string | Digest | ||
WS-Security Username | The user that may call the service. When it is set, each request must carry a WS-Security UsernameToken of this user and | string |
Dependencies
At runtime, the soap-source Kamelet relies upon the presence of the following dependencies:
-
camel:cxf-soap
-
camel:kamelet
Camel JBang usage
Prerequisites
-
You’ve installed JBang.
-
You have executed the following command:
jbang app install camel@apache/camel Supposing you have a file named route.yaml with this content:
- route:
from:
uri: "kamelet:soap-source"
parameters:
.
.
.
steps:
- to:
uri: "kamelet:log-sink" You can now run it directly through the following command
camel run route.yaml