SOAP Action
Provided by: "Apache Software Foundation"
Support Level for this Kamelet is: "Preview"
Calls an operation of a SOAP web service described by a WSDL file for each message, and gives back the response.
Use it to call an existing SOAP service from a route, such as an order or customer service of an older system, with XML and without generating Java code from the WSDL. To serve a SOAP service, use soap-source.
Input: the body is the request element of the operation as XML text, such as <getOrder xmlns="http://example.com/orders"><orderId>7</orderId></getOrder>. It is put in the SOAP Body as it is.
Output: the body is the content of the SOAP Body of the response as XML text: the response element of the operation, such as <getOrderResponse xmlns="http://example.com/orders">…</getOrderResponse>.
Good to know: a SOAP fault from the service fails the message with an org.apache.cxf.binding.soap.SoapFault error, whose message is the text of the fault, so that a route can catch it by its class name. When faultAsBody is true, the message goes on instead: the body is the content of the detail element of the fault as XML text, such as the fault element the WSDL declares (no body when the fault has no detail), the header SoapFault is the text of the fault, and SoapFaultCode its code: Client or Server with SOAP 1.1, Sender or Receiver with SOAP 1.2. A request that the service refuses, for example because it does not match its XML schema, is a SOAP fault too. SOAP 1.1 or 1.2 is used as the WSDL says. To log in with a WS-Security UsernameToken, set wsSecurityUsername and wsSecurityPassword: 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. A service that refuses the UsernameToken, for example because of a wrong password, answers with a SOAP fault whose code is SecurityError. Headers that start with Camel, and the SOAPAction, Authorization and Proxy-Authorization headers, are removed from the message first, so a message cannot change the address, the operation or the login.
Configuration Options
The following table summarizes the configuration options available for the soap-action Kamelet:
| Property | Name | Description | Type | Default | Example |
|---|---|---|---|---|---|
Operation | Required The name of the operation to call, as the WSDL names it. | string | getOrder | ||
WSDL Location | Required Where to read the WSDL file of the service from. | string | https://legacy.example.com/orders?wsdl | ||
Address | The URL of the SOAP service. When it is not set, the address that the WSDL gives for the port is called, the | string | https://legacy.example.com/orders | ||
Fault As Body | Whether a SOAP fault from the service gives a message with the detail of the fault as body and the | boolean | false | ||
Operation Namespace | The namespace of the operation. Only needed when the WSDL has two operations of the same name. | string | http://example.com/orders | ||
Password | The password for HTTP Basic authentication. | string | |||
Port Name | The port of the service to call, as | string | {http://example.com/orders}OrderPort | ||
Service Name | The service of the WSDL to call, as | string | {http://example.com/orders}OrderService | ||
Username | The user name for HTTP Basic authentication. When it is set, every request carries it, with | string | |||
WS-Security Password | The password of | string | |||
WS-Security Password Type | How the UsernameToken carries the password. Enum values: * Text * Digest | string | Digest | ||
WS-Security Username | The user name to send in a WS-Security UsernameToken, in the SOAP header of each request, for a service that requires one. It is not the same as | string |
Dependencies
At runtime, the soap-action Kamelet relies upon the presence of the following dependencies:
-
camel:cxf-soap
-
camel:xpath
-
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:timer-source"
parameters:
period: 10000
message: 'test'
steps:
- to:
uri: "kamelet:soap-action"
parameters:
.
.
.
- to:
uri: "kamelet:log-sink" You can now run it directly through the following command
camel run route.yaml