This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-kamelets.git
The following commit(s) were added to refs/heads/main by this push:
new b257615ad Fix #3335: new soap-source and soap-action Kamelets, serve
or call a SOAP web service from its WSDL (#3341)
b257615ad is described below
commit b257615adfffcdf531e8286be018bc14b716c0fe
Author: Claus Ibsen <[email protected]>
AuthorDate: Sun Nov 22 08:01:56 2026 +0100
Fix #3335: new soap-source and soap-action Kamelets, serve or call a SOAP
web service from its WSDL (#3341)
* Fix #3335: new soap-source and soap-action Kamelets, serve or call a SOAP
web service from its WSDL
soap-source serves a SOAP service described by a WSDL with camel-cxf in
PAYLOAD mode, so no Java code is
generated: the route gets the request element as XML text and the operation
in CamelCxfOperationName, and its
reply is the SOAP response. The route returns a declared SOAP fault by
setting the SoapFault and SoapFaultCode
headers (SOAP 1.1 or 1.2 as the request), and a route failure gives a muted
fault. The request and the reply are
checked against the schema of the WSDL by default, a DOCTYPE is refused,
publishedEndpointUrl sets the address of
the served WSDL, and the reply headers are not sent back as HTTP headers.
soap-action calls an operation of a SOAP service from its WSDL with XML
text in and out. A SOAP fault fails the
message, or with faultAsBody gives the detail as body and the SoapFault and
SoapFaultCode headers, which soap-source
takes to pass the fault on. The Camel* headers (operation,
CamelDestinationOverrideUrl), SOAPAction, the login
headers and relayed CXF headers are removed before the call.
Both Kamelets are XML only and Preview; JSON can be had with
xj-identity-action in the route. A JSON mode is left for
an XSD-driven JSON <-> XML mapping in Camel. The new Soap tests run a SOAP
front in front of a legacy service (reply,
declared fault passed on, fault without detail, muted failure, DOCTYPE
refused, published WSDL address, headers
stripped, HTTP Basic login) and a SOAP 1.2 service.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016Y4dDmBDsSWV117kccuNf9
* chore: regenerate the catalog files after merging main
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016Y4dDmBDsSWV117kccuNf9
---------
Co-authored-by: Claude Opus 5.5 <[email protected]>
---
.../camel-kamelets-catalog-sbom.json | 46 +++++-
docs/modules/ROOT/nav.adoc | 2 +
kamelets/soap-action.kamelet.yaml | 176 +++++++++++++++++++++
kamelets/soap-source.kamelet.yaml | 160 +++++++++++++++++++
.../main/resources/META-INF/kamelets-index.json | 20 +++
.../resources/kamelets/soap-action.kamelet.yaml | 176 +++++++++++++++++++++
.../resources/kamelets/soap-source.kamelet.yaml | 160 +++++++++++++++++++
.../camel-kamelets-itest/src/test/java/SoapIT.java | 55 +++++++
.../src/test/resources/soap/orders.wsdl | 114 +++++++++++++
.../src/test/resources/soap/orders12.wsdl | 114 +++++++++++++
.../test/resources/soap/soap-backend-route.yaml | 53 +++++++
.../soap/soap-front-backend.citrus.it.yaml | 171 ++++++++++++++++++++
.../src/test/resources/soap/soap-front-route.yaml | 66 ++++++++
.../test/resources/soap/soap-soap12.citrus.it.yaml | 66 ++++++++
.../src/test/resources/soap/soap12-route.yaml | 43 +++++
15 files changed, 1421 insertions(+), 1 deletion(-)
diff --git a/camel-kamelets-sbom/camel-kamelets-catalog-sbom.json
b/camel-kamelets-sbom/camel-kamelets-catalog-sbom.json
index ed0857ff9..eb8858cba 100644
--- a/camel-kamelets-sbom/camel-kamelets-catalog-sbom.json
+++ b/camel-kamelets-sbom/camel-kamelets-catalog-sbom.json
@@ -1031,6 +1031,16 @@
"type" : "library",
"name" : "snowflake-source",
"version" : "4.24.0-SNAPSHOT"
+ }, {
+ "bom-ref" : "kamelet:soap-action",
+ "type" : "library",
+ "name" : "soap-action",
+ "version" : "4.24.0-SNAPSHOT"
+ }, {
+ "bom-ref" : "kamelet:soap-source",
+ "type" : "library",
+ "name" : "soap-source",
+ "version" : "4.24.0-SNAPSHOT"
}, {
"bom-ref" : "kamelet:solr-sink",
"type" : "library",
@@ -1520,6 +1530,17 @@
"name" : "camel.apache.org/versioned-by",
"value" : "runtime"
} ]
+ }, {
+ "bom-ref" : "pkg:maven/org.apache.camel/[email protected]",
+ "type" : "library",
+ "group" : "org.apache.camel",
+ "name" : "camel-cxf-soap",
+ "version" : "4.24.0-SNAPSHOT",
+ "purl" : "pkg:maven/org.apache.camel/[email protected]",
+ "properties" : [ {
+ "name" : "camel.apache.org/versioned-by",
+ "value" : "runtime"
+ } ]
}, {
"bom-ref" : "pkg:maven/org.apache.camel/[email protected]",
"type" : "library",
@@ -2345,6 +2366,17 @@
"name" : "camel.apache.org/versioned-by",
"value" : "runtime"
} ]
+ }, {
+ "bom-ref" : "pkg:maven/org.apache.camel/[email protected]",
+ "type" : "library",
+ "group" : "org.apache.camel",
+ "name" : "camel-xpath",
+ "version" : "4.24.0-SNAPSHOT",
+ "purl" : "pkg:maven/org.apache.camel/[email protected]",
+ "properties" : [ {
+ "name" : "camel.apache.org/versioned-by",
+ "value" : "runtime"
+ } ]
}, {
"bom-ref" : "pkg:maven/org.apache.camel/[email protected]",
"type" : "library",
@@ -2387,7 +2419,7 @@
} ],
"dependencies" : [ {
"ref" : "camel-kamelets-catalog",
- "dependsOn" : [ "kamelet:avro-deserialize-action",
"kamelet:avro-serialize-action", "kamelet:aws-bedrock-agent-runtime-sink",
"kamelet:aws-bedrock-agent-sink", "kamelet:aws-bedrock-text-sink",
"kamelet:aws-cloudtrail-source", "kamelet:aws-cloudwatch-sink",
"kamelet:aws-comprehend-sink", "kamelet:aws-ddb-sink",
"kamelet:aws-ddb-streams-source", "kamelet:aws-ec2-sink",
"kamelet:aws-eventbridge-sink", "kamelet:aws-eventbridge-source",
"kamelet:aws-kinesis-firehose-sink", "kamelet:aws-ki [...]
+ "dependsOn" : [ "kamelet:avro-deserialize-action",
"kamelet:avro-serialize-action", "kamelet:aws-bedrock-agent-runtime-sink",
"kamelet:aws-bedrock-agent-sink", "kamelet:aws-bedrock-text-sink",
"kamelet:aws-cloudtrail-source", "kamelet:aws-cloudwatch-sink",
"kamelet:aws-comprehend-sink", "kamelet:aws-ddb-sink",
"kamelet:aws-ddb-streams-source", "kamelet:aws-ec2-sink",
"kamelet:aws-eventbridge-sink", "kamelet:aws-eventbridge-source",
"kamelet:aws-kinesis-firehose-sink", "kamelet:aws-ki [...]
}, {
"ref" : "kamelet:avro-deserialize-action",
"dependsOn" : [
"pkg:maven/org.apache.camel/[email protected]",
"pkg:maven/org.apache.camel/[email protected]" ]
@@ -3000,6 +3032,12 @@
}, {
"ref" : "kamelet:snowflake-source",
"dependsOn" : [ "pkg:maven/net.snowflake/[email protected]",
"pkg:maven/org.apache.camel/[email protected]",
"pkg:maven/org.apache.camel/[email protected]",
"pkg:maven/org.apache.camel/[email protected]",
"pkg:maven/org.apache.commons/[email protected]" ]
+ }, {
+ "ref" : "kamelet:soap-action",
+ "dependsOn" : [
"pkg:maven/org.apache.camel/[email protected]",
"pkg:maven/org.apache.camel/[email protected]",
"pkg:maven/org.apache.camel/[email protected]" ]
+ }, {
+ "ref" : "kamelet:soap-source",
+ "dependsOn" : [
"pkg:maven/org.apache.camel/[email protected]",
"pkg:maven/org.apache.camel/[email protected]" ]
}, {
"ref" : "kamelet:solr-sink",
"dependsOn" : [
"pkg:maven/org.apache.camel/[email protected]",
"pkg:maven/org.apache.camel/[email protected]",
"pkg:maven/org.apache.camel/[email protected]" ]
@@ -3177,6 +3215,9 @@
}, {
"ref" : "pkg:maven/org.apache.camel/[email protected]",
"dependsOn" : [ ]
+ }, {
+ "ref" : "pkg:maven/org.apache.camel/[email protected]",
+ "dependsOn" : [ ]
}, {
"ref" : "pkg:maven/org.apache.camel/[email protected]",
"dependsOn" : [ ]
@@ -3402,6 +3443,9 @@
}, {
"ref" : "pkg:maven/org.apache.camel/[email protected]",
"dependsOn" : [ ]
+ }, {
+ "ref" : "pkg:maven/org.apache.camel/[email protected]",
+ "dependsOn" : [ ]
}, {
"ref" : "pkg:maven/org.apache.camel/[email protected]",
"dependsOn" : [ ]
diff --git a/docs/modules/ROOT/nav.adoc b/docs/modules/ROOT/nav.adoc
index 4b634cb1b..59a61509b 100644
--- a/docs/modules/ROOT/nav.adoc
+++ b/docs/modules/ROOT/nav.adoc
@@ -203,6 +203,8 @@
* xref:snmp-source.adoc[]
* xref:snowflake-sink.adoc[]
* xref:snowflake-source.adoc[]
+* xref:soap-action.adoc[]
+* xref:soap-source.adoc[]
* xref:solr-sink.adoc[]
* xref:solr-source.adoc[]
* xref:splunk-hec-sink.adoc[]
diff --git a/kamelets/soap-action.kamelet.yaml
b/kamelets/soap-action.kamelet.yaml
new file mode 100644
index 000000000..200312a7f
--- /dev/null
+++ b/kamelets/soap-action.kamelet.yaml
@@ -0,0 +1,176 @@
+# ---------------------------------------------------------------------------
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ---------------------------------------------------------------------------
+apiVersion: camel.apache.org/v1
+kind: Kamelet
+metadata:
+ name: soap-action
+ annotations:
+ camel.apache.org/kamelet.support.level: "Preview"
+ camel.apache.org/catalog.version: "4.24.0-SNAPSHOT"
+ camel.apache.org/kamelet.icon:
"data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI0MjAiCmhlaWdodD0iNDIwIiBzdHJva2U9IiMwMDAiIGZpbGw9Im5vbmUiPgo8cGF0aCBzdHJva2Utd2lkdGg9IjI2IgpkPSJNMjA5LDE1YTE5NSwxOTUgMCAxLDAgMiwweiIvPgo8cGF0aCBzdHJva2Utd2lkdGg9IjE4IgpkPSJtMjEwLDE1djM5MG0xOTUtMTk1SDE1TTU5LDkwYTI2MCwyNjAgMCAwLDAgMzAyLDAgbTAsMjQwIGEyNjAsMjYwIDAgMCwwLTMwMiwwTTE5NSwyMGEyNTAsMjUwIDAgMCwwIDAsMzgyIG0zMC
[...]
+ camel.apache.org/provider: "Apache Software Foundation"
+ camel.apache.org/kamelet.group: "SOAP"
+ camel.apache.org/kamelet.namespace: "HTTP"
+ labels:
+ camel.apache.org/kamelet.type: "action"
+ camel.apache.org/kamelet.verified: "true"
+spec:
+ definition:
+ title: "SOAP Action"
+ description: |-
+ 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; with Camel JBang, a route that catches this error by its class name
needs the dependency `camel:cxf-soap`. 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 hea [...]
+ required:
+ - address
+ - wsdlURL
+ - operation
+ type: object
+ properties:
+ address:
+ title: Address
+ description: The URL of the SOAP service.
+ type: string
+ example: "https://legacy.example.com/orders"
+ pattern: "^https?://.+"
+ wsdlURL:
+ title: WSDL Location
+ description: 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`.
+ type: string
+ example: "https://legacy.example.com/orders?wsdl"
+ pattern: "^(file|classpath|https?):.+"
+ operation:
+ title: Operation
+ description: The name of the operation to call, as the WSDL names it.
+ type: string
+ example: "getOrder"
+ operationNamespace:
+ title: Operation Namespace
+ description: The namespace of the operation. Only needed when the WSDL
has two operations of the same name.
+ type: string
+ example: "http://example.com/orders"
+ serviceName:
+ title: Service Name
+ description: 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.
+ type: string
+ example: "{http://example.com/orders}OrderService"
+ pattern: "^\\{[^}]*\\}[^{}]+$"
+ portName:
+ title: Port Name
+ description: 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.
+ type: string
+ example: "{http://example.com/orders}OrderPort"
+ pattern: "^\\{[^}]*\\}[^{}]+$"
+ faultAsBody:
+ title: Fault As Body
+ description: 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.
+ type: boolean
+ default: false
+ username:
+ title: Username
+ description: The user name for HTTP Basic authentication. When it is
set, every request carries it, with `password`.
+ type: string
+ x-descriptors:
+ - urn:camel:group:credentials
+ password:
+ title: Password
+ description: The password for HTTP Basic authentication.
+ type: string
+ format: password
+ x-descriptors:
+ - urn:camel:group:credentials
+ dataTypes:
+ # No 'default:' on purpose: the body is the XML of the request and of the
response, as it is. See #3117.
+ in:
+ headers: {}
+ out:
+ headers:
+ SoapFault:
+ title: SOAP Fault
+ description: The text of the SOAP fault that the service returned.
Only set when `faultAsBody` is true.
+ type: string
+ SoapFaultCode:
+ title: SOAP Fault Code
+ description: The code of the SOAP fault, such as `Client` or
`Server`. Only set when `faultAsBody` is true.
+ type: string
+ dependencies:
+ - "camel:cxf-soap"
+ - "camel:xpath"
+ - "camel:kamelet"
+ template:
+ from:
+ uri: kamelet:source
+ steps:
+ # The operation (CamelCxfOperationName, the former operationName), the
address (CamelDestinationOverrideUrl)
+ # and the CXF request context come from the options only. SOAPAction
and the login headers would be sent as
+ # HTTP headers, and SOAP headers that came in through soap-source
would be relayed.
+ - removeHeaders:
+ pattern:
Camel.*|RequestContext|ResponseContext|operationName|operationNamespace|SoapFault.*|SOAPAction|Authorization|Proxy-Authorization|org\.apache\.cxf\..*
+ - doTry:
+ steps:
+ - to:
+ uri:
"cxf://{{address}}?wsdlURL=RAW({{wsdlURL}})&serviceName={{?serviceName}}&portName={{?portName}}&dataFormat=PAYLOAD&defaultOperationName={{operation}}&defaultOperationNamespace={{?operationNamespace}}&username=RAW({{?username}})&password=RAW({{?password}})"
+ - convertBodyTo:
+ type: java.lang.String
+ - doCatch:
+ exception:
+ - org.apache.cxf.binding.soap.SoapFault
+ onWhen:
+ expression:
+ simple:
+ expression: "{{faultAsBody}}"
+ steps:
+ - setHeader:
+ name: SoapFault
+ expression:
+ simple:
+ expression: "${exception.message}"
+ - setHeader:
+ name: SoapFaultCode
+ expression:
+ simple:
+ expression: "${exception.faultCode.localPart}"
+ # the content of the detail element: the fault elements,
as XML text
+ - choice:
+ when:
+ - expression:
+ simple:
+ expression: "${exception.detail} != null"
+ steps:
+ - setBody:
+ expression:
+ simple:
+ expression: "${exception.detail}"
+ - transform:
+ expression:
+ xpath:
+ resultType: org.w3c.dom.NodeList
+ expression: /*/*
+ - convertBodyTo:
+ type: java.lang.String
+ otherwise:
+ steps:
+ - setBody:
+ expression:
+ simple:
+ expression: "${null}"
diff --git a/kamelets/soap-source.kamelet.yaml
b/kamelets/soap-source.kamelet.yaml
new file mode 100644
index 000000000..4accb9ff9
--- /dev/null
+++ b/kamelets/soap-source.kamelet.yaml
@@ -0,0 +1,160 @@
+# ---------------------------------------------------------------------------
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ---------------------------------------------------------------------------
+apiVersion: camel.apache.org/v1
+kind: Kamelet
+metadata:
+ name: soap-source
+ annotations:
+ camel.apache.org/kamelet.support.level: "Preview"
+ camel.apache.org/catalog.version: "4.24.0-SNAPSHOT"
+ camel.apache.org/kamelet.icon:
"data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI0MjAiCmhlaWdodD0iNDIwIiBzdHJva2U9IiMwMDAiIGZpbGw9Im5vbmUiPgo8cGF0aCBzdHJva2Utd2lkdGg9IjI2IgpkPSJNMjA5LDE1YTE5NSwxOTUgMCAxLDAgMiwweiIvPgo8cGF0aCBzdHJva2Utd2lkdGg9IjE4IgpkPSJtMjEwLDE1djM5MG0xOTUtMTk1SDE1TTU5LDkwYTI2MCwyNjAgMCAwLDAgMzAyLDAgbTAsMjQwIGEyNjAsMjYwIDAgMCwwLTMwMiwwTTE5NSwyMGEyNTAsMjUwIDAgMCwwIDAsMzgyIG0zMC
[...]
+ camel.apache.org/provider: "Apache Software Foundation"
+ camel.apache.org/kamelet.group: "SOAP"
+ camel.apache.org/kamelet.namespace: "HTTP"
+ labels:
+ camel.apache.org/kamelet.type: "source"
+ camel.apache.org/kamelet.verified: "true"
+spec:
+ definition:
+ title: "SOAP Source"
+ description: |-
+ 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 [...]
+
+ 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:
protect the address with your network. To work with JSON, turn the body into
JSON with `xj-identity-action`, a [...]
+ required:
+ - address
+ - wsdlURL
+ type: object
+ properties:
+ address:
+ title: Address
+ description: The URL to serve the SOAP service at. Use `0.0.0.0` as
the host to accept calls on every network interface of the machine.
+ type: string
+ example: "http://0.0.0.0:8080/orders"
+ pattern: "^https?://.+"
+ wsdlURL:
+ title: WSDL Location
+ description: Where to read the WSDL file from, which describes the
operations and their XML schema. `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).
+ type: string
+ example: "classpath:orders.wsdl"
+ pattern: "^(file|classpath|https?):.+"
+ serviceName:
+ title: Service Name
+ description: The service of the WSDL to serve, as `\{namespace}name`.
Only needed when the WSDL has more than one service; otherwise the first one is
used.
+ type: string
+ example: "{http://example.com/orders}OrderService"
+ pattern: "^\\{[^}]*\\}[^{}]+$"
+ portName:
+ title: Port Name
+ description: The port of the service to serve, as `\{namespace}name`.
Only needed when the service has more than one port; otherwise the first one is
used.
+ type: string
+ example: "{http://example.com/orders}OrderPort"
+ pattern: "^\\{[^}]*\\}[^{}]+$"
+ publishedEndpointUrl:
+ title: Published URL
+ description: The URL that the WSDL served at `?wsdl` gives to the
clients as the address of the service, such as the public URL of a load
balancer. When it is not set, the WSDL gives the host that the client used in
its request.
+ type: string
+ example: "https://orders.example.com/orders"
+ pattern: "^https?://.+"
+ schemaValidation:
+ title: Schema Validation
+ description: Whether to refuse a request, and a reply of the route,
that does not match the XML schema of the WSDL.
+ type: boolean
+ default: true
+ loggingEnabled:
+ title: Log Messages
+ description: Whether to write each SOAP request and response to the
log. Do not turn it on when the messages hold personal data or secrets.
+ type: boolean
+ default: false
+ dataTypes:
+ # No 'default:' on purpose: the body stays as the SOAP service gives it.
See #3117.
+ out:
+ headers:
+ CamelCxfOperationName:
+ title: Operation Name
+ description: The name of the operation that was called, such as
`getOrder`.
+ type: string
+ CamelCxfOperationNamespace:
+ title: Operation Namespace
+ description: The namespace of the operation, such as
`http://example.com/orders`.
+ type: string
+ dependencies:
+ - "camel:cxf-soap"
+ - "camel:kamelet"
+ template:
+ from:
+ uri:
"cxf://{{address}}?wsdlURL=RAW({{wsdlURL}})&serviceName={{?serviceName}}&portName={{?portName}}&publishedEndpointUrl=RAW({{?publishedEndpointUrl}})&dataFormat=PAYLOAD&schemaValidationEnabled={{schemaValidation}}&loggingFeatureEnabled={{loggingEnabled}}"
+ steps:
+ # The headers that make the reply a fault come from the route, never
from the client. CamelHttp* would
+ # steer an HTTP call later in the route, and CamelCxfMessage is the
whole internal CXF message.
+ - removeHeaders:
+ pattern: SoapFault.*|CamelHttp.*|CamelCxfMessage
+ # kept to answer a SOAP 1.2 request (content type
application/soap+xml) with a SOAP 1.2 fault
+ - setVariable:
+ name: soapSourceContentType
+ expression:
+ simple:
+ expression: "${header.Content-Type}"
+ - convertBodyTo:
+ type: java.lang.String
+ - to:
+ uri: kamelet:sink
+ # The headers of the reply would be sent back as HTTP headers,
including the ones that came with the request
+ # or from systems the route called. Only the fault is taken from them.
+ - setVariable:
+ name: soapSourceFault
+ expression:
+ simple:
+ expression: "${header.SoapFault}"
+ - setVariable:
+ name: soapSourceFaultCode
+ expression:
+ simple:
+ expression: "${header.SoapFaultCode}"
+ - removeHeaders:
+ pattern: "*"
+ - choice:
+ when:
+ - expression:
+ simple:
+ expression: "${variable.soapSourceFault} != null"
+ steps:
+ - choice:
+ when:
+ - expression:
+ simple:
+ expression: "${variable.soapSourceContentType}
startsWith 'application/soap+xml'"
+ steps:
+ - setBody:
+ expression:
+ simple:
+ expression: "<env:Fault
xmlns:env=\"http://www.w3.org/2003/05/soap-envelope\"><env:Code><env:Value>env:${variable.soapSourceFaultCode
== 'Client' ? 'Sender' :
'Receiver'}</env:Value></env:Code><env:Reason><env:Text
xml:lang=\"en\">${escape(xml,
${variable.soapSourceFault})}</env:Text></env:Reason><env:Detail>${body}</env:Detail></env:Fault>"
+ otherwise:
+ steps:
+ - setBody:
+ expression:
+ simple:
+ expression: "<soap:Fault
xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\"><faultcode>soap:${variable.soapSourceFaultCode
== 'Client' ? 'Client' : 'Server'}</faultcode><faultstring>${escape(xml,
${variable.soapSourceFault})}</faultstring><detail>${body}</detail></soap:Fault>"
+ # As a CXF payload, the consumer returns it as a SOAP fault;
as text it would be a normal reply.
+ - convertBodyTo:
+ type: org.apache.camel.component.cxf.common.CxfPayload
diff --git
a/library/camel-kamelets/src/main/resources/META-INF/kamelets-index.json
b/library/camel-kamelets/src/main/resources/META-INF/kamelets-index.json
index dd459e456..c9c960f6e 100644
--- a/library/camel-kamelets/src/main/resources/META-INF/kamelets-index.json
+++ b/library/camel-kamelets/src/main/resources/META-INF/kamelets-index.json
@@ -2039,6 +2039,26 @@
"group" : "SQL",
"namespace" : "Database",
"provider" : "Apache Software Foundation"
+ }, {
+ "name" : "soap-action",
+ "type" : "action",
+ "supportLevel" : "Preview",
+ "title" : "SOAP Action",
+ "summary" : "Calls an operation of a SOAP web service described by a WSDL
file for each message, and gives back the response.",
+ "description" : "Calls an operation of a SOAP web service described by a
WSDL file for each message, and gives back the response.\n\nUse 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`.\n\nInput: the body is the request element of
the operation as XML text, such as `<getOrder
xmlns=\"http://example.com/orders\"><orderId>7</orde [...]
+ "group" : "SOAP",
+ "namespace" : "HTTP",
+ "provider" : "Apache Software Foundation"
+ }, {
+ "name" : "soap-source",
+ "type" : "source",
+ "supportLevel" : "Preview",
+ "title" : "SOAP Source",
+ "summary" : "Serves a SOAP web service described by a WSDL file, and
answers each call with the reply of the route.",
+ "description" : "Serves a SOAP web service described by a WSDL file, and
answers each call with the reply of the route.\n\nUse 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`.\n\nOutput: the body is the content of the SOAP Body of the
request as XML text: the request element of [...]
+ "group" : "SOAP",
+ "namespace" : "HTTP",
+ "provider" : "Apache Software Foundation"
}, {
"name" : "solr-sink",
"type" : "sink",
diff --git
a/library/camel-kamelets/src/main/resources/kamelets/soap-action.kamelet.yaml
b/library/camel-kamelets/src/main/resources/kamelets/soap-action.kamelet.yaml
new file mode 100644
index 000000000..200312a7f
--- /dev/null
+++
b/library/camel-kamelets/src/main/resources/kamelets/soap-action.kamelet.yaml
@@ -0,0 +1,176 @@
+# ---------------------------------------------------------------------------
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ---------------------------------------------------------------------------
+apiVersion: camel.apache.org/v1
+kind: Kamelet
+metadata:
+ name: soap-action
+ annotations:
+ camel.apache.org/kamelet.support.level: "Preview"
+ camel.apache.org/catalog.version: "4.24.0-SNAPSHOT"
+ camel.apache.org/kamelet.icon:
"data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI0MjAiCmhlaWdodD0iNDIwIiBzdHJva2U9IiMwMDAiIGZpbGw9Im5vbmUiPgo8cGF0aCBzdHJva2Utd2lkdGg9IjI2IgpkPSJNMjA5LDE1YTE5NSwxOTUgMCAxLDAgMiwweiIvPgo8cGF0aCBzdHJva2Utd2lkdGg9IjE4IgpkPSJtMjEwLDE1djM5MG0xOTUtMTk1SDE1TTU5LDkwYTI2MCwyNjAgMCAwLDAgMzAyLDAgbTAsMjQwIGEyNjAsMjYwIDAgMCwwLTMwMiwwTTE5NSwyMGEyNTAsMjUwIDAgMCwwIDAsMzgyIG0zMC
[...]
+ camel.apache.org/provider: "Apache Software Foundation"
+ camel.apache.org/kamelet.group: "SOAP"
+ camel.apache.org/kamelet.namespace: "HTTP"
+ labels:
+ camel.apache.org/kamelet.type: "action"
+ camel.apache.org/kamelet.verified: "true"
+spec:
+ definition:
+ title: "SOAP Action"
+ description: |-
+ 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; with Camel JBang, a route that catches this error by its class name
needs the dependency `camel:cxf-soap`. 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 hea [...]
+ required:
+ - address
+ - wsdlURL
+ - operation
+ type: object
+ properties:
+ address:
+ title: Address
+ description: The URL of the SOAP service.
+ type: string
+ example: "https://legacy.example.com/orders"
+ pattern: "^https?://.+"
+ wsdlURL:
+ title: WSDL Location
+ description: 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`.
+ type: string
+ example: "https://legacy.example.com/orders?wsdl"
+ pattern: "^(file|classpath|https?):.+"
+ operation:
+ title: Operation
+ description: The name of the operation to call, as the WSDL names it.
+ type: string
+ example: "getOrder"
+ operationNamespace:
+ title: Operation Namespace
+ description: The namespace of the operation. Only needed when the WSDL
has two operations of the same name.
+ type: string
+ example: "http://example.com/orders"
+ serviceName:
+ title: Service Name
+ description: 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.
+ type: string
+ example: "{http://example.com/orders}OrderService"
+ pattern: "^\\{[^}]*\\}[^{}]+$"
+ portName:
+ title: Port Name
+ description: 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.
+ type: string
+ example: "{http://example.com/orders}OrderPort"
+ pattern: "^\\{[^}]*\\}[^{}]+$"
+ faultAsBody:
+ title: Fault As Body
+ description: 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.
+ type: boolean
+ default: false
+ username:
+ title: Username
+ description: The user name for HTTP Basic authentication. When it is
set, every request carries it, with `password`.
+ type: string
+ x-descriptors:
+ - urn:camel:group:credentials
+ password:
+ title: Password
+ description: The password for HTTP Basic authentication.
+ type: string
+ format: password
+ x-descriptors:
+ - urn:camel:group:credentials
+ dataTypes:
+ # No 'default:' on purpose: the body is the XML of the request and of the
response, as it is. See #3117.
+ in:
+ headers: {}
+ out:
+ headers:
+ SoapFault:
+ title: SOAP Fault
+ description: The text of the SOAP fault that the service returned.
Only set when `faultAsBody` is true.
+ type: string
+ SoapFaultCode:
+ title: SOAP Fault Code
+ description: The code of the SOAP fault, such as `Client` or
`Server`. Only set when `faultAsBody` is true.
+ type: string
+ dependencies:
+ - "camel:cxf-soap"
+ - "camel:xpath"
+ - "camel:kamelet"
+ template:
+ from:
+ uri: kamelet:source
+ steps:
+ # The operation (CamelCxfOperationName, the former operationName), the
address (CamelDestinationOverrideUrl)
+ # and the CXF request context come from the options only. SOAPAction
and the login headers would be sent as
+ # HTTP headers, and SOAP headers that came in through soap-source
would be relayed.
+ - removeHeaders:
+ pattern:
Camel.*|RequestContext|ResponseContext|operationName|operationNamespace|SoapFault.*|SOAPAction|Authorization|Proxy-Authorization|org\.apache\.cxf\..*
+ - doTry:
+ steps:
+ - to:
+ uri:
"cxf://{{address}}?wsdlURL=RAW({{wsdlURL}})&serviceName={{?serviceName}}&portName={{?portName}}&dataFormat=PAYLOAD&defaultOperationName={{operation}}&defaultOperationNamespace={{?operationNamespace}}&username=RAW({{?username}})&password=RAW({{?password}})"
+ - convertBodyTo:
+ type: java.lang.String
+ - doCatch:
+ exception:
+ - org.apache.cxf.binding.soap.SoapFault
+ onWhen:
+ expression:
+ simple:
+ expression: "{{faultAsBody}}"
+ steps:
+ - setHeader:
+ name: SoapFault
+ expression:
+ simple:
+ expression: "${exception.message}"
+ - setHeader:
+ name: SoapFaultCode
+ expression:
+ simple:
+ expression: "${exception.faultCode.localPart}"
+ # the content of the detail element: the fault elements,
as XML text
+ - choice:
+ when:
+ - expression:
+ simple:
+ expression: "${exception.detail} != null"
+ steps:
+ - setBody:
+ expression:
+ simple:
+ expression: "${exception.detail}"
+ - transform:
+ expression:
+ xpath:
+ resultType: org.w3c.dom.NodeList
+ expression: /*/*
+ - convertBodyTo:
+ type: java.lang.String
+ otherwise:
+ steps:
+ - setBody:
+ expression:
+ simple:
+ expression: "${null}"
diff --git
a/library/camel-kamelets/src/main/resources/kamelets/soap-source.kamelet.yaml
b/library/camel-kamelets/src/main/resources/kamelets/soap-source.kamelet.yaml
new file mode 100644
index 000000000..4accb9ff9
--- /dev/null
+++
b/library/camel-kamelets/src/main/resources/kamelets/soap-source.kamelet.yaml
@@ -0,0 +1,160 @@
+# ---------------------------------------------------------------------------
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ---------------------------------------------------------------------------
+apiVersion: camel.apache.org/v1
+kind: Kamelet
+metadata:
+ name: soap-source
+ annotations:
+ camel.apache.org/kamelet.support.level: "Preview"
+ camel.apache.org/catalog.version: "4.24.0-SNAPSHOT"
+ camel.apache.org/kamelet.icon:
"data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI0MjAiCmhlaWdodD0iNDIwIiBzdHJva2U9IiMwMDAiIGZpbGw9Im5vbmUiPgo8cGF0aCBzdHJva2Utd2lkdGg9IjI2IgpkPSJNMjA5LDE1YTE5NSwxOTUgMCAxLDAgMiwweiIvPgo8cGF0aCBzdHJva2Utd2lkdGg9IjE4IgpkPSJtMjEwLDE1djM5MG0xOTUtMTk1SDE1TTU5LDkwYTI2MCwyNjAgMCAwLDAgMzAyLDAgbTAsMjQwIGEyNjAsMjYwIDAgMCwwLTMwMiwwTTE5NSwyMGEyNTAsMjUwIDAgMCwwIDAsMzgyIG0zMC
[...]
+ camel.apache.org/provider: "Apache Software Foundation"
+ camel.apache.org/kamelet.group: "SOAP"
+ camel.apache.org/kamelet.namespace: "HTTP"
+ labels:
+ camel.apache.org/kamelet.type: "source"
+ camel.apache.org/kamelet.verified: "true"
+spec:
+ definition:
+ title: "SOAP Source"
+ description: |-
+ 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 [...]
+
+ 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:
protect the address with your network. To work with JSON, turn the body into
JSON with `xj-identity-action`, a [...]
+ required:
+ - address
+ - wsdlURL
+ type: object
+ properties:
+ address:
+ title: Address
+ description: The URL to serve the SOAP service at. Use `0.0.0.0` as
the host to accept calls on every network interface of the machine.
+ type: string
+ example: "http://0.0.0.0:8080/orders"
+ pattern: "^https?://.+"
+ wsdlURL:
+ title: WSDL Location
+ description: Where to read the WSDL file from, which describes the
operations and their XML schema. `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).
+ type: string
+ example: "classpath:orders.wsdl"
+ pattern: "^(file|classpath|https?):.+"
+ serviceName:
+ title: Service Name
+ description: The service of the WSDL to serve, as `\{namespace}name`.
Only needed when the WSDL has more than one service; otherwise the first one is
used.
+ type: string
+ example: "{http://example.com/orders}OrderService"
+ pattern: "^\\{[^}]*\\}[^{}]+$"
+ portName:
+ title: Port Name
+ description: The port of the service to serve, as `\{namespace}name`.
Only needed when the service has more than one port; otherwise the first one is
used.
+ type: string
+ example: "{http://example.com/orders}OrderPort"
+ pattern: "^\\{[^}]*\\}[^{}]+$"
+ publishedEndpointUrl:
+ title: Published URL
+ description: The URL that the WSDL served at `?wsdl` gives to the
clients as the address of the service, such as the public URL of a load
balancer. When it is not set, the WSDL gives the host that the client used in
its request.
+ type: string
+ example: "https://orders.example.com/orders"
+ pattern: "^https?://.+"
+ schemaValidation:
+ title: Schema Validation
+ description: Whether to refuse a request, and a reply of the route,
that does not match the XML schema of the WSDL.
+ type: boolean
+ default: true
+ loggingEnabled:
+ title: Log Messages
+ description: Whether to write each SOAP request and response to the
log. Do not turn it on when the messages hold personal data or secrets.
+ type: boolean
+ default: false
+ dataTypes:
+ # No 'default:' on purpose: the body stays as the SOAP service gives it.
See #3117.
+ out:
+ headers:
+ CamelCxfOperationName:
+ title: Operation Name
+ description: The name of the operation that was called, such as
`getOrder`.
+ type: string
+ CamelCxfOperationNamespace:
+ title: Operation Namespace
+ description: The namespace of the operation, such as
`http://example.com/orders`.
+ type: string
+ dependencies:
+ - "camel:cxf-soap"
+ - "camel:kamelet"
+ template:
+ from:
+ uri:
"cxf://{{address}}?wsdlURL=RAW({{wsdlURL}})&serviceName={{?serviceName}}&portName={{?portName}}&publishedEndpointUrl=RAW({{?publishedEndpointUrl}})&dataFormat=PAYLOAD&schemaValidationEnabled={{schemaValidation}}&loggingFeatureEnabled={{loggingEnabled}}"
+ steps:
+ # The headers that make the reply a fault come from the route, never
from the client. CamelHttp* would
+ # steer an HTTP call later in the route, and CamelCxfMessage is the
whole internal CXF message.
+ - removeHeaders:
+ pattern: SoapFault.*|CamelHttp.*|CamelCxfMessage
+ # kept to answer a SOAP 1.2 request (content type
application/soap+xml) with a SOAP 1.2 fault
+ - setVariable:
+ name: soapSourceContentType
+ expression:
+ simple:
+ expression: "${header.Content-Type}"
+ - convertBodyTo:
+ type: java.lang.String
+ - to:
+ uri: kamelet:sink
+ # The headers of the reply would be sent back as HTTP headers,
including the ones that came with the request
+ # or from systems the route called. Only the fault is taken from them.
+ - setVariable:
+ name: soapSourceFault
+ expression:
+ simple:
+ expression: "${header.SoapFault}"
+ - setVariable:
+ name: soapSourceFaultCode
+ expression:
+ simple:
+ expression: "${header.SoapFaultCode}"
+ - removeHeaders:
+ pattern: "*"
+ - choice:
+ when:
+ - expression:
+ simple:
+ expression: "${variable.soapSourceFault} != null"
+ steps:
+ - choice:
+ when:
+ - expression:
+ simple:
+ expression: "${variable.soapSourceContentType}
startsWith 'application/soap+xml'"
+ steps:
+ - setBody:
+ expression:
+ simple:
+ expression: "<env:Fault
xmlns:env=\"http://www.w3.org/2003/05/soap-envelope\"><env:Code><env:Value>env:${variable.soapSourceFaultCode
== 'Client' ? 'Sender' :
'Receiver'}</env:Value></env:Code><env:Reason><env:Text
xml:lang=\"en\">${escape(xml,
${variable.soapSourceFault})}</env:Text></env:Reason><env:Detail>${body}</env:Detail></env:Fault>"
+ otherwise:
+ steps:
+ - setBody:
+ expression:
+ simple:
+ expression: "<soap:Fault
xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\"><faultcode>soap:${variable.soapSourceFaultCode
== 'Client' ? 'Client' : 'Server'}</faultcode><faultstring>${escape(xml,
${variable.soapSourceFault})}</faultstring><detail>${body}</detail></soap:Fault>"
+ # As a CXF payload, the consumer returns it as a SOAP fault;
as text it would be a normal reply.
+ - convertBodyTo:
+ type: org.apache.camel.component.cxf.common.CxfPayload
diff --git a/tests/camel-kamelets-itest/src/test/java/SoapIT.java
b/tests/camel-kamelets-itest/src/test/java/SoapIT.java
new file mode 100644
index 000000000..efe2f595b
--- /dev/null
+++ b/tests/camel-kamelets-itest/src/test/java/SoapIT.java
@@ -0,0 +1,55 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.util.stream.Stream;
+
+import org.citrusframework.api.common.TestLoader;
+import org.citrusframework.container.SequenceBeforeTest;
+import org.citrusframework.junit.jupiter.CitrusSupport;
+import org.citrusframework.junit.jupiter.CitrusTestFactory;
+import org.citrusframework.junit.jupiter.CitrusTestFactorySupport;
+import org.citrusframework.spi.BindToRegistry;
+import org.junit.jupiter.api.DynamicTest;
+
+import static
org.citrusframework.actions.CreateVariablesAction.Builder.createVariables;
+
+/**
+ * The SOAP Kamelets: soap-source serves the WSDL of the tests, and
soap-action calls it. Each test serves its services
+ * on ports of its own, so that a service of one test does not hold the port
of the next while it stops.
+ */
+@CitrusSupport
+public class SoapIT {
+
+ private final int backendPort = ServerPorts.next();
+ private final int frontPort = ServerPorts.next();
+ private final int soap12Port = ServerPorts.next();
+
+ @BindToRegistry
+ public SequenceBeforeTest beforeSoap() {
+ return new SequenceBeforeTest.Builder().onTests("soap-*").actions(
+ createVariables()
+ .variable("soap.backend.port",
String.valueOf(backendPort))
+ .variable("soap.front.port", String.valueOf(frontPort))
+ .variable("soap.soap12.port",
String.valueOf(soap12Port))
+ ).build();
+ }
+
+ @CitrusTestFactory
+ public Stream<DynamicTest> soap() {
+ return
CitrusTestFactorySupport.factory(TestLoader.YAML).packageScan("soap");
+ }
+}
diff --git a/tests/camel-kamelets-itest/src/test/resources/soap/orders.wsdl
b/tests/camel-kamelets-itest/src/test/resources/soap/orders.wsdl
new file mode 100644
index 000000000..5826635ea
--- /dev/null
+++ b/tests/camel-kamelets-itest/src/test/resources/soap/orders.wsdl
@@ -0,0 +1,114 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<!-- A small document/literal wrapped SOAP 1.1 service for the soap-source and
soap-action tests -->
+<wsdl:definitions name="OrderService"
+ targetNamespace="http://example.com/orders"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ xmlns:tns="http://example.com/orders">
+
+ <wsdl:types>
+ <xs:schema targetNamespace="http://example.com/orders"
elementFormDefault="qualified">
+ <xs:complexType name="Item">
+ <xs:sequence>
+ <xs:element name="sku" type="xs:string"/>
+ <xs:element name="quantity" type="xs:int"/>
+ <xs:element name="price" type="xs:decimal"/>
+ </xs:sequence>
+ </xs:complexType>
+ <xs:complexType name="Order">
+ <xs:sequence>
+ <xs:element name="orderId" type="xs:string"/>
+ <xs:element name="customer" type="xs:string"/>
+ <xs:element name="status" type="xs:string"/>
+ <xs:element name="item" type="tns:Item" maxOccurs="unbounded"/>
+ </xs:sequence>
+ </xs:complexType>
+
+ <xs:element name="getOrder">
+ <xs:complexType><xs:sequence>
+ <xs:element name="orderId" type="xs:string"/>
+ </xs:sequence></xs:complexType>
+ </xs:element>
+ <xs:element name="getOrderResponse">
+ <xs:complexType><xs:sequence>
+ <xs:element name="order" type="tns:Order"/>
+ </xs:sequence></xs:complexType>
+ </xs:element>
+
+ <xs:element name="placeOrder">
+ <xs:complexType><xs:sequence>
+ <xs:element name="customer" type="xs:string"/>
+ <xs:element name="item" type="tns:Item" maxOccurs="unbounded"/>
+ </xs:sequence></xs:complexType>
+ </xs:element>
+ <xs:element name="placeOrderResponse">
+ <xs:complexType><xs:sequence>
+ <xs:element name="orderId" type="xs:string"/>
+ <xs:element name="status" type="xs:string"/>
+ </xs:sequence></xs:complexType>
+ </xs:element>
+
+ <xs:element name="orderNotFound">
+ <xs:complexType><xs:sequence>
+ <xs:element name="orderId" type="xs:string"/>
+ </xs:sequence></xs:complexType>
+ </xs:element>
+ </xs:schema>
+ </wsdl:types>
+
+ <wsdl:message name="getOrderRequest"><wsdl:part name="parameters"
element="tns:getOrder"/></wsdl:message>
+ <wsdl:message name="getOrderResponse"><wsdl:part name="parameters"
element="tns:getOrderResponse"/></wsdl:message>
+ <wsdl:message name="placeOrderRequest"><wsdl:part name="parameters"
element="tns:placeOrder"/></wsdl:message>
+ <wsdl:message name="placeOrderResponse"><wsdl:part name="parameters"
element="tns:placeOrderResponse"/></wsdl:message>
+ <wsdl:message name="orderNotFoundFault"><wsdl:part name="fault"
element="tns:orderNotFound"/></wsdl:message>
+
+ <wsdl:portType name="OrderPortType">
+ <wsdl:operation name="getOrder">
+ <wsdl:input message="tns:getOrderRequest"/>
+ <wsdl:output message="tns:getOrderResponse"/>
+ <wsdl:fault name="orderNotFound" message="tns:orderNotFoundFault"/>
+ </wsdl:operation>
+ <wsdl:operation name="placeOrder">
+ <wsdl:input message="tns:placeOrderRequest"/>
+ <wsdl:output message="tns:placeOrderResponse"/>
+ </wsdl:operation>
+ </wsdl:portType>
+
+ <wsdl:binding name="OrderSoapBinding" type="tns:OrderPortType">
+ <soap:binding style="document"
transport="http://schemas.xmlsoap.org/soap/http"/>
+ <wsdl:operation name="getOrder">
+ <soap:operation soapAction="http://example.com/orders/getOrder"/>
+ <wsdl:input><soap:body use="literal"/></wsdl:input>
+ <wsdl:output><soap:body use="literal"/></wsdl:output>
+ <wsdl:fault name="orderNotFound"><soap:fault name="orderNotFound"
use="literal"/></wsdl:fault>
+ </wsdl:operation>
+ <wsdl:operation name="placeOrder">
+ <soap:operation soapAction="http://example.com/orders/placeOrder"/>
+ <wsdl:input><soap:body use="literal"/></wsdl:input>
+ <wsdl:output><soap:body use="literal"/></wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+
+ <wsdl:service name="OrderService">
+ <wsdl:port name="OrderPort" binding="tns:OrderSoapBinding">
+ <soap:address location="http://localhost:8080/orders"/>
+ </wsdl:port>
+ </wsdl:service>
+</wsdl:definitions>
diff --git a/tests/camel-kamelets-itest/src/test/resources/soap/orders12.wsdl
b/tests/camel-kamelets-itest/src/test/resources/soap/orders12.wsdl
new file mode 100644
index 000000000..934c7da49
--- /dev/null
+++ b/tests/camel-kamelets-itest/src/test/resources/soap/orders12.wsdl
@@ -0,0 +1,114 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<!-- A small document/literal wrapped SOAP 1.2 service for the soap-source and
soap-action tests -->
+<wsdl:definitions name="OrderService"
+ targetNamespace="http://example.com/orders"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap12/"
+ xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ xmlns:tns="http://example.com/orders">
+
+ <wsdl:types>
+ <xs:schema targetNamespace="http://example.com/orders"
elementFormDefault="qualified">
+ <xs:complexType name="Item">
+ <xs:sequence>
+ <xs:element name="sku" type="xs:string"/>
+ <xs:element name="quantity" type="xs:int"/>
+ <xs:element name="price" type="xs:decimal"/>
+ </xs:sequence>
+ </xs:complexType>
+ <xs:complexType name="Order">
+ <xs:sequence>
+ <xs:element name="orderId" type="xs:string"/>
+ <xs:element name="customer" type="xs:string"/>
+ <xs:element name="status" type="xs:string"/>
+ <xs:element name="item" type="tns:Item" maxOccurs="unbounded"/>
+ </xs:sequence>
+ </xs:complexType>
+
+ <xs:element name="getOrder">
+ <xs:complexType><xs:sequence>
+ <xs:element name="orderId" type="xs:string"/>
+ </xs:sequence></xs:complexType>
+ </xs:element>
+ <xs:element name="getOrderResponse">
+ <xs:complexType><xs:sequence>
+ <xs:element name="order" type="tns:Order"/>
+ </xs:sequence></xs:complexType>
+ </xs:element>
+
+ <xs:element name="placeOrder">
+ <xs:complexType><xs:sequence>
+ <xs:element name="customer" type="xs:string"/>
+ <xs:element name="item" type="tns:Item" maxOccurs="unbounded"/>
+ </xs:sequence></xs:complexType>
+ </xs:element>
+ <xs:element name="placeOrderResponse">
+ <xs:complexType><xs:sequence>
+ <xs:element name="orderId" type="xs:string"/>
+ <xs:element name="status" type="xs:string"/>
+ </xs:sequence></xs:complexType>
+ </xs:element>
+
+ <xs:element name="orderNotFound">
+ <xs:complexType><xs:sequence>
+ <xs:element name="orderId" type="xs:string"/>
+ </xs:sequence></xs:complexType>
+ </xs:element>
+ </xs:schema>
+ </wsdl:types>
+
+ <wsdl:message name="getOrderRequest"><wsdl:part name="parameters"
element="tns:getOrder"/></wsdl:message>
+ <wsdl:message name="getOrderResponse"><wsdl:part name="parameters"
element="tns:getOrderResponse"/></wsdl:message>
+ <wsdl:message name="placeOrderRequest"><wsdl:part name="parameters"
element="tns:placeOrder"/></wsdl:message>
+ <wsdl:message name="placeOrderResponse"><wsdl:part name="parameters"
element="tns:placeOrderResponse"/></wsdl:message>
+ <wsdl:message name="orderNotFoundFault"><wsdl:part name="fault"
element="tns:orderNotFound"/></wsdl:message>
+
+ <wsdl:portType name="OrderPortType">
+ <wsdl:operation name="getOrder">
+ <wsdl:input message="tns:getOrderRequest"/>
+ <wsdl:output message="tns:getOrderResponse"/>
+ <wsdl:fault name="orderNotFound" message="tns:orderNotFoundFault"/>
+ </wsdl:operation>
+ <wsdl:operation name="placeOrder">
+ <wsdl:input message="tns:placeOrderRequest"/>
+ <wsdl:output message="tns:placeOrderResponse"/>
+ </wsdl:operation>
+ </wsdl:portType>
+
+ <wsdl:binding name="OrderSoapBinding" type="tns:OrderPortType">
+ <soap:binding style="document"
transport="http://schemas.xmlsoap.org/soap/http"/>
+ <wsdl:operation name="getOrder">
+ <soap:operation soapAction="http://example.com/orders/getOrder"/>
+ <wsdl:input><soap:body use="literal"/></wsdl:input>
+ <wsdl:output><soap:body use="literal"/></wsdl:output>
+ <wsdl:fault name="orderNotFound"><soap:fault name="orderNotFound"
use="literal"/></wsdl:fault>
+ </wsdl:operation>
+ <wsdl:operation name="placeOrder">
+ <soap:operation soapAction="http://example.com/orders/placeOrder"/>
+ <wsdl:input><soap:body use="literal"/></wsdl:input>
+ <wsdl:output><soap:body use="literal"/></wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+
+ <wsdl:service name="OrderService">
+ <wsdl:port name="OrderPort" binding="tns:OrderSoapBinding">
+ <soap:address location="http://localhost:8080/orders"/>
+ </wsdl:port>
+ </wsdl:service>
+</wsdl:definitions>
diff --git
a/tests/camel-kamelets-itest/src/test/resources/soap/soap-backend-route.yaml
b/tests/camel-kamelets-itest/src/test/resources/soap/soap-backend-route.yaml
new file mode 100644
index 000000000..30c227821
--- /dev/null
+++ b/tests/camel-kamelets-itest/src/test/resources/soap/soap-backend-route.yaml
@@ -0,0 +1,53 @@
+# ---------------------------------------------------------------------------
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ---------------------------------------------------------------------------
+# The legacy SOAP service of orders.wsdl, served by soap-source with the XML
of the WSDL
+- route:
+ id: "legacy-orders"
+ from:
+ uri: "kamelet:soap-source"
+ parameters:
+ address: "http://0.0.0.0:{{soap.backend.port}}/orders"
+ wsdlURL: "classpath:orders.wsdl"
+ steps:
+ # what came with the call: the SOAPAction of the WSDL and no login,
whatever the caller had in its headers
+ - log: "Backend ${header.CamelCxfOperationName}
SOAPAction=${header.SOAPAction} Authorization=${header.Authorization}: ${body}"
+ - setVariable:
+ name: "orderId"
+ simple: "${xpath(/*/*[local-name()='orderId']/text())}"
+ - choice:
+ when:
+ # the declared fault of getOrder
+ - simple: "${variable.orderId} == '404'"
+ steps:
+ - setHeader:
+ name: "SoapFault"
+ simple: "Order ${variable.orderId} not found"
+ - setHeader:
+ name: "SoapFaultCode"
+ constant: "Client"
+ - setBody:
+ simple: '<orderNotFound
xmlns="http://example.com/orders"><orderId>${variable.orderId}</orderId></orderNotFound>'
+ # a failure of the route: the client must not learn why
+ - simple: "${variable.orderId} == '500'"
+ steps:
+ - throwException:
+ exceptionType: "java.lang.IllegalStateException"
+ message: "Database password s3cret rejected"
+ otherwise:
+ steps:
+ - setBody:
+ simple: '<getOrderResponse
xmlns="http://example.com/orders"><order><orderId>${variable.orderId}</orderId><customer>ACME</customer><status>SHIPPED</status><item><sku>A-1</sku><quantity>2</quantity><price>9.95</price></item></order></getOrderResponse>'
diff --git
a/tests/camel-kamelets-itest/src/test/resources/soap/soap-front-backend.citrus.it.yaml
b/tests/camel-kamelets-itest/src/test/resources/soap/soap-front-backend.citrus.it.yaml
new file mode 100644
index 000000000..dc463c449
--- /dev/null
+++
b/tests/camel-kamelets-itest/src/test/resources/soap/soap-front-backend.citrus.it.yaml
@@ -0,0 +1,171 @@
+# ---------------------------------------------------------------------------
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ---------------------------------------------------------------------------
+
+name: soap-front-backend-test
+description: 'soap-source serves a SOAP front that calls a legacy SOAP service
with soap-action: a reply, a declared fault passed on, a muted route failure, a
DOCTYPE refused'
+actions:
+ # The legacy service, then the front that calls it
+ - camel:
+ cli:
+ run:
+ resources:
+ - "orders.wsdl"
+ integration:
+ file: "soap/soap-backend-route.yaml"
+ systemProperties:
+ properties:
+ - name: "soap.backend.port"
+ value: "${soap.backend.port}"
+ - camel:
+ cli:
+ run:
+ resources:
+ - "orders.wsdl"
+ integration:
+ file: "soap/soap-front-route.yaml"
+ systemProperties:
+ properties:
+ - name: "soap.backend.port"
+ value: "${soap.backend.port}"
+ - name: "soap.front.port"
+ value: "${soap.front.port}"
+
+ # getOrder through the front: the reply of the legacy service, with the
status the front changed
+ - http:
+ client: "http://localhost:${soap.front.port}"
+ sendRequest:
+ POST:
+ path: "/orders"
+ contentType: "text/xml"
+ body:
+ data: '<soap:Envelope
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><o:getOrder
xmlns:o="http://example.com/orders"><o:orderId>7</o:orderId></o:getOrder></soap:Body></soap:Envelope>'
+ - http:
+ client: "http://localhost:${soap.front.port}"
+ receiveResponse:
+ response:
+ status: 200
+ type: "plaintext"
+ body:
+ data:
'@contains(''<order><orderId>7</orderId><customer>ACME</customer><status>shipped</status><item><sku>A-1</sku><quantity>2</quantity><price>9.95</price></item></order></getOrderResponse></soap:Body></soap:Envelope>'')@'
+ # The front had the request as JSON
+ - camel:
+ cli:
+ verify:
+ integration: "soap-front-route"
+ logMessage: 'Front getOrder as JSON: {"orderId":"7"}'
+ # The legacy service got the SOAPAction of the WSDL and the login of the
options (front:s3cret), not the headers
+ # the front had set
+ - camel:
+ cli:
+ verify:
+ integration: "soap-backend-route"
+ logMessage: 'Backend getOrder
SOAPAction=http://example.com/orders/getOrder Authorization=Basic
ZnJvbnQ6czNjcmV0: <getOrder xmlns="http://example.com/orders"'
+
+ # The declared fault of the legacy service, passed on by the front with its
detail
+ - http:
+ client: "http://localhost:${soap.front.port}"
+ sendRequest:
+ POST:
+ path: "/orders"
+ contentType: "text/xml"
+ body:
+ data: '<soap:Envelope
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><o:getOrder
xmlns:o="http://example.com/orders"><o:orderId>404</o:orderId></o:getOrder></soap:Body></soap:Envelope>'
+ - http:
+ client: "http://localhost:${soap.front.port}"
+ receiveResponse:
+ response:
+ status: 500
+ type: "plaintext"
+ body:
+ data:
'@contains(''<soap:Fault><faultcode>soap:Client</faultcode><faultstring>Order
404 not found</faultstring><detail><orderNotFound
xmlns="http://example.com/orders"><orderId>404</orderId></orderNotFound></detail></soap:Fault>'')@'
+ - camel:
+ cli:
+ verify:
+ integration: "soap-front-route"
+ logMessage: 'Front got SoapFault=Order 404 not found
SoapFaultCode=Client: <orderNotFound
xmlns="http://example.com/orders"><orderId>404</orderId></orderNotFound>'
+
+ # A fault without detail, passed on by the front
+ - http:
+ client: "http://localhost:${soap.front.port}"
+ sendRequest:
+ POST:
+ path: "/orders"
+ contentType: "text/xml"
+ body:
+ data: '<soap:Envelope
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><o:getOrder
xmlns:o="http://example.com/orders"><o:orderId>500</o:orderId></o:getOrder></soap:Body></soap:Envelope>'
+ - http:
+ client: "http://localhost:${soap.front.port}"
+ receiveResponse:
+ response:
+ status: 500
+ type: "plaintext"
+ body:
+ data:
'@contains(''<soap:Fault><faultcode>soap:Server</faultcode><faultstring>Exchange
processing failed</faultstring><detail/></soap:Fault>'')@'
+
+ # A failure of the legacy route: the fault does not say why
+ - http:
+ client: "http://localhost:${soap.backend.port}"
+ sendRequest:
+ POST:
+ path: "/orders"
+ contentType: "text/xml"
+ body:
+ data: '<soap:Envelope
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><o:getOrder
xmlns:o="http://example.com/orders"><o:orderId>500</o:orderId></o:getOrder></soap:Body></soap:Envelope>'
+ - http:
+ client: "http://localhost:${soap.backend.port}"
+ receiveResponse:
+ response:
+ status: 500
+ type: "plaintext"
+ body:
+ data: '<soap:Envelope
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><soap:Fault><faultcode>soap:Server</faultcode><faultstring>Exchange
processing failed</faultstring></soap:Fault></soap:Body></soap:Envelope>'
+
+ # A request with a DOCTYPE is refused before the route sees it
+ - http:
+ client: "http://localhost:${soap.backend.port}"
+ sendRequest:
+ POST:
+ path: "/orders"
+ contentType: "text/xml"
+ body:
+ data: '<?xml version="1.0"?><!DOCTYPE foo [<!ENTITY xxe SYSTEM
"file:///etc/hosts">]><soap:Envelope
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><o:getOrder
xmlns:o="http://example.com/orders"><o:orderId>&xxe;</o:orderId></o:getOrder></soap:Body></soap:Envelope>'
+ - http:
+ client: "http://localhost:${soap.backend.port}"
+ receiveResponse:
+ response:
+ status: 500
+ type: "plaintext"
+ body:
+ data:
'@contains(''<faultcode>soap:Client</faultcode><faultstring>Error reading
XMLStreamReader: Received event DTD'')@'
+
+ # The WSDL of the front gives the published address
+ - http:
+ client: "http://localhost:${soap.front.port}"
+ sendRequest:
+ GET:
+ path: "/orders"
+ parameters:
+ - name: "wsdl"
+ value: ""
+ - http:
+ client: "http://localhost:${soap.front.port}"
+ receiveResponse:
+ response:
+ status: 200
+ type: "plaintext"
+ body:
+ data: '@contains(''<soap:address
location="https://orders.example.com/orders"/>'')@'
diff --git
a/tests/camel-kamelets-itest/src/test/resources/soap/soap-front-route.yaml
b/tests/camel-kamelets-itest/src/test/resources/soap/soap-front-route.yaml
new file mode 100644
index 000000000..aa1230af5
--- /dev/null
+++ b/tests/camel-kamelets-itest/src/test/resources/soap/soap-front-route.yaml
@@ -0,0 +1,66 @@
+# ---------------------------------------------------------------------------
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ---------------------------------------------------------------------------
+# The SOAP front: serves orders.wsdl with soap-source, works with the request
as JSON, and calls the legacy service
+# with soap-action. Its own getOrder answers with the status of the legacy
service in lower case.
+- route:
+ id: "orders-front"
+ from:
+ uri: "kamelet:soap-source"
+ parameters:
+ address: "http://0.0.0.0:{{soap.front.port}}/orders"
+ wsdlURL: "classpath:orders.wsdl"
+ publishedEndpointUrl: "https://orders.example.com/orders"
+ steps:
+ - to:
+ uri: "kamelet:xj-identity-action"
+ parameters:
+ direction: "XML2JSON"
+ - log: "Front ${header.CamelCxfOperationName} as JSON: ${body}"
+ - setVariable:
+ name: "orderId"
+ jq: ".orderId"
+ - setBody:
+ simple: '<getOrder
xmlns="http://example.com/orders"><orderId>${escape(xml,
${variable.orderId})}</orderId></getOrder>'
+ # headers that must not change what soap-action calls, or how
+ - setHeader:
+ name: "CamelDestinationOverrideUrl"
+ constant: "http://localhost:1/elsewhere"
+ - setHeader:
+ name: "CamelCxfOperationName"
+ constant: "placeOrder"
+ - setHeader:
+ name: "SOAPAction"
+ constant: "http://example.com/orders/placeOrder"
+ - setHeader:
+ name: "Authorization"
+ constant: "Basic dXNlcjpzZWNyZXQ="
+ - to:
+ uri: "kamelet:soap-action"
+ parameters:
+ address: "http://localhost:{{soap.backend.port}}/orders"
+ wsdlURL: "classpath:orders.wsdl"
+ operation: "getOrder"
+ faultAsBody: true
+ username: "front"
+ password: "s3cret"
+ - log: "Front got SoapFault=${header.SoapFault}
SoapFaultCode=${header.SoapFaultCode}: ${body}"
+ - choice:
+ when:
+ - simple: "${header.SoapFault} == null"
+ steps:
+ - setBody:
+ simple: "${body.replace('<status>SHIPPED</status>',
'<status>shipped</status>')}"
diff --git
a/tests/camel-kamelets-itest/src/test/resources/soap/soap-soap12.citrus.it.yaml
b/tests/camel-kamelets-itest/src/test/resources/soap/soap-soap12.citrus.it.yaml
new file mode 100644
index 000000000..166b5cb91
--- /dev/null
+++
b/tests/camel-kamelets-itest/src/test/resources/soap/soap-soap12.citrus.it.yaml
@@ -0,0 +1,66 @@
+# ---------------------------------------------------------------------------
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ---------------------------------------------------------------------------
+
+name: soap-soap12-test
+description: 'soap-source serves a WSDL with a SOAP 1.2 binding: a reply and a
declared fault, both in SOAP 1.2'
+actions:
+ - camel:
+ cli:
+ run:
+ resources:
+ - "orders12.wsdl"
+ integration:
+ file: "soap/soap12-route.yaml"
+ systemProperties:
+ properties:
+ - name: "soap.soap12.port"
+ value: "${soap.soap12.port}"
+
+ - http:
+ client: "http://localhost:${soap.soap12.port}"
+ sendRequest:
+ POST:
+ path: "/orders"
+ contentType: "application/soap+xml"
+ body:
+ data: '<env:Envelope
xmlns:env="http://www.w3.org/2003/05/soap-envelope"><env:Body><o:getOrder
xmlns:o="http://example.com/orders"><o:orderId>12</o:orderId></o:getOrder></env:Body></env:Envelope>'
+ - http:
+ client: "http://localhost:${soap.soap12.port}"
+ receiveResponse:
+ response:
+ status: 200
+ type: "plaintext"
+ body:
+ data: '<soap:Envelope
xmlns:soap="http://www.w3.org/2003/05/soap-envelope"><soap:Body><getOrderResponse
xmlns="http://example.com/orders"><order><orderId>12</orderId><customer>ACME</customer><status>NEW</status><item><sku>A-1</sku><quantity>1</quantity><price>1.00</price></item></order></getOrderResponse></soap:Body></soap:Envelope>'
+
+ # SoapFaultCode Client is the SOAP 1.2 code Sender
+ - http:
+ client: "http://localhost:${soap.soap12.port}"
+ sendRequest:
+ POST:
+ path: "/orders"
+ contentType: "application/soap+xml"
+ body:
+ data: '<env:Envelope
xmlns:env="http://www.w3.org/2003/05/soap-envelope"><env:Body><o:getOrder
xmlns:o="http://example.com/orders"><o:orderId>404</o:orderId></o:getOrder></env:Body></env:Envelope>'
+ - http:
+ client: "http://localhost:${soap.soap12.port}"
+ receiveResponse:
+ response:
+ status: 500
+ type: "plaintext"
+ body:
+ data:
'@contains(''env:Sender</soap:Value></soap:Code><soap:Reason><soap:Text
xml:lang="en">Order 404 not
found</soap:Text></soap:Reason><soap:Detail><orderNotFound
xmlns="http://example.com/orders"><orderId>404</orderId></orderNotFound></soap:Detail>'')@'
diff --git
a/tests/camel-kamelets-itest/src/test/resources/soap/soap12-route.yaml
b/tests/camel-kamelets-itest/src/test/resources/soap/soap12-route.yaml
new file mode 100644
index 000000000..e5757b0a9
--- /dev/null
+++ b/tests/camel-kamelets-itest/src/test/resources/soap/soap12-route.yaml
@@ -0,0 +1,43 @@
+# ---------------------------------------------------------------------------
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ---------------------------------------------------------------------------
+# The service of orders12.wsdl, with its SOAP 1.2 binding, served by
soap-source
+- route:
+ id: "orders-soap12"
+ from:
+ uri: "kamelet:soap-source"
+ parameters:
+ address: "http://0.0.0.0:{{soap.soap12.port}}/orders"
+ wsdlURL: "classpath:orders12.wsdl"
+ serviceName: "{http://example.com/orders}OrderService"
+ portName: "{http://example.com/orders}OrderPort"
+ steps:
+ - choice:
+ when:
+ - simple: "${body} contains '>404<'"
+ steps:
+ - setHeader:
+ name: "SoapFault"
+ constant: "Order 404 not found"
+ - setHeader:
+ name: "SoapFaultCode"
+ constant: "Client"
+ - setBody:
+ constant: '<orderNotFound
xmlns="http://example.com/orders"><orderId>404</orderId></orderNotFound>'
+ otherwise:
+ steps:
+ - setBody:
+ constant: '<getOrderResponse
xmlns="http://example.com/orders"><order><orderId>12</orderId><customer>ACME</customer><status>NEW</status><item><sku>A-1</sku><quantity>1</quantity><price>1.00</price></item></order></getOrderResponse>'