Kamelet Catalog

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

Operation

Required The name of the operation to call, as the WSDL names it.

string

getOrder

wsdlURL

WSDL Location

Required Where to read the WSDL file of the service from. file: followed by a path, classpath: followed by a resource in the application, or an https:// URL (an http:// URL works too, but the WSDL decides what is called, so it should not travel unprotected), such as the address of the service followed by ?wsdl.

string

https://legacy.example.com/orders?wsdl

address

Address

The URL of the SOAP service. When it is not set, the address that the WSDL gives for the port is called, the location of its soap:address.

string

https://legacy.example.com/orders

faultAsBody

Fault As Body

Whether a SOAP fault from the service gives a message with the detail of the fault as body and the SoapFault and SoapFaultCode headers, instead of failing the message.

boolean

false

operationNamespace

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

Password

The password for HTTP Basic authentication.

string

portName

Port Name

The port of the service to call, as \{namespace}name. Only needed when the service has more than one port; otherwise the first one is used.

string

{http://example.com/orders}OrderPort

serviceName

Service Name

The service of the WSDL to call, as \{namespace}name. Only needed when the WSDL has more than one service; otherwise the first one is used.

string

{http://example.com/orders}OrderService

username

Username

The user name for HTTP Basic authentication. When it is set, every request carries it, with password.

string

wsSecurityPassword

WS-Security Password

The password of wsSecurityUsername, sent in the UsernameToken.

string

wsSecurityPasswordType

WS-Security Password Type

How the UsernameToken carries the password. Text sends it as it is, so only use it over HTTPS. Digest sends a SHA-1 digest of it, which is no replacement for HTTPS. It must be the type the service requires, or the service refuses the token. When the WSDL has a WS-SecurityPolicy, the policy decides instead. When it is not set, Text.

Enum values:

* Text * Digest

string

Digest

wsSecurityUsername

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 username, which is for HTTP Basic authentication. Set wsSecurityPassword too.

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