This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch camel-4.22.x
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/camel-4.22.x by this push:
     new 692d1a5024e4 [backport camel-4.22.x] CAMEL-25225: camel-spring-ws - 
apply the HeaderFilterStrategy to producer response headers (#27256)
692d1a5024e4 is described below

commit 692d1a5024e4e1c430c563e4b4798e8e9eb392e0
Author: Andrea Cosentino <[email protected]>
AuthorDate: Fri Oct 2 09:52:55 2026 +0200

    [backport camel-4.22.x] CAMEL-25225: camel-spring-ws - apply the 
HeaderFilterStrategy to producer response headers (#27256)
    
    Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
---
 .../apache/camel/catalog/components/spring-ws.json |  2 +-
 .../camel/component/spring/ws/spring-ws.json       |  2 +-
 .../spring/ws/SpringWebserviceConfiguration.java   |  4 +-
 .../spring/ws/SpringWebserviceProducer.java        | 31 +++++--
 .../spring/ws/ProducerSoapHeaderFilterTest.java    | 98 ++++++++++++++++++++++
 .../ResponseSoapHeaderMessageFilter.java           | 51 +++++++++++
 .../ws/ProducerSoapHeaderFilterTest-context.xml    | 70 ++++++++++++++++
 .../SpringWebserviceEndpointBuilderFactory.java    | 10 ++-
 8 files changed, 254 insertions(+), 14 deletions(-)

diff --git 
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/spring-ws.json
 
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/spring-ws.json
index cf9a2d659e76..106c37c92bb5 100644
--- 
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/spring-ws.json
+++ 
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/spring-ws.json
@@ -53,7 +53,7 @@
     "exceptionHandler": { "index": 10, "kind": "parameter", "displayName": 
"Exception Handler", "group": "consumer (advanced)", "label": 
"consumer,advanced", "required": false, "type": "object", "javaType": 
"org.apache.camel.spi.ExceptionHandler", "optionalPrefix": "consumer.", 
"deprecated": false, "autowired": false, "secret": false, "description": "To 
let the consumer use a custom ExceptionHandler. Notice if the option 
bridgeErrorHandler is enabled then this option is not in use. By de [...]
     "exchangePattern": { "index": 11, "kind": "parameter", "displayName": 
"Exchange Pattern", "group": "consumer (advanced)", "label": 
"consumer,advanced", "required": false, "type": "enum", "javaType": 
"org.apache.camel.ExchangePattern", "enum": [ "InOnly", "InOut" ], 
"deprecated": false, "autowired": false, "secret": false, "description": "Sets 
the exchange pattern when the consumer creates an exchange." },
     "allowResponseAttachmentOverride": { "index": 12, "kind": "parameter", 
"displayName": "Allow Response Attachment Override", "group": "producer", 
"label": "producer", "required": false, "type": "boolean", "javaType": 
"boolean", "deprecated": false, "autowired": false, "secret": false, 
"defaultValue": false, "configurationClass": 
"org.apache.camel.component.spring.ws.SpringWebserviceConfiguration", 
"configurationField": "configuration", "description": "Option to override soap 
response  [...]
-    "allowResponseHeaderOverride": { "index": 13, "kind": "parameter", 
"displayName": "Allow Response Header Override", "group": "producer", "label": 
"producer", "required": false, "type": "boolean", "javaType": "boolean", 
"deprecated": false, "autowired": false, "secret": false, "defaultValue": 
false, "configurationClass": 
"org.apache.camel.component.spring.ws.SpringWebserviceConfiguration", 
"configurationField": "configuration", "description": "Option to override soap 
response header i [...]
+    "allowResponseHeaderOverride": { "index": 13, "kind": "parameter", 
"displayName": "Allow Response Header Override", "group": "producer", "label": 
"producer", "required": false, "type": "boolean", "javaType": "boolean", 
"deprecated": false, "autowired": false, "secret": false, "defaultValue": 
false, "configurationClass": 
"org.apache.camel.component.spring.ws.SpringWebserviceConfiguration", 
"configurationField": "configuration", "description": "Option to override soap 
response header i [...]
     "faultAction": { "index": 14, "kind": "parameter", "displayName": "Fault 
Action", "group": "producer", "label": "producer", "required": false, "type": 
"string", "javaType": "java.net.URI", "deprecated": false, "autowired": false, 
"secret": false, "configurationClass": 
"org.apache.camel.component.spring.ws.SpringWebserviceConfiguration", 
"configurationField": "configuration", "description": "Signifies the value for 
the faultAction response WS-Addressing Fault Action header that is pro [...]
     "faultTo": { "index": 15, "kind": "parameter", "displayName": "Fault To", 
"group": "producer", "label": "producer", "required": false, "type": "string", 
"javaType": "java.net.URI", "deprecated": false, "autowired": false, "secret": 
false, "configurationClass": 
"org.apache.camel.component.spring.ws.SpringWebserviceConfiguration", 
"configurationField": "configuration", "description": "Signifies the value for 
the faultAction response WS-Addressing FaultTo header that is provided by the  
[...]
     "messageFactory": { "index": 16, "kind": "parameter", "displayName": 
"Message Factory", "group": "producer", "label": "producer", "required": false, 
"type": "object", "javaType": 
"org.springframework.ws.WebServiceMessageFactory", "deprecated": false, 
"autowired": false, "secret": false, "configurationClass": 
"org.apache.camel.component.spring.ws.SpringWebserviceConfiguration", 
"configurationField": "configuration", "description": "Option to provide a 
custom WebServiceMessageFactory." },
diff --git 
a/components/camel-spring-parent/camel-spring-ws/src/generated/resources/META-INF/org/apache/camel/component/spring/ws/spring-ws.json
 
b/components/camel-spring-parent/camel-spring-ws/src/generated/resources/META-INF/org/apache/camel/component/spring/ws/spring-ws.json
index cf9a2d659e76..106c37c92bb5 100644
--- 
a/components/camel-spring-parent/camel-spring-ws/src/generated/resources/META-INF/org/apache/camel/component/spring/ws/spring-ws.json
+++ 
b/components/camel-spring-parent/camel-spring-ws/src/generated/resources/META-INF/org/apache/camel/component/spring/ws/spring-ws.json
@@ -53,7 +53,7 @@
     "exceptionHandler": { "index": 10, "kind": "parameter", "displayName": 
"Exception Handler", "group": "consumer (advanced)", "label": 
"consumer,advanced", "required": false, "type": "object", "javaType": 
"org.apache.camel.spi.ExceptionHandler", "optionalPrefix": "consumer.", 
"deprecated": false, "autowired": false, "secret": false, "description": "To 
let the consumer use a custom ExceptionHandler. Notice if the option 
bridgeErrorHandler is enabled then this option is not in use. By de [...]
     "exchangePattern": { "index": 11, "kind": "parameter", "displayName": 
"Exchange Pattern", "group": "consumer (advanced)", "label": 
"consumer,advanced", "required": false, "type": "enum", "javaType": 
"org.apache.camel.ExchangePattern", "enum": [ "InOnly", "InOut" ], 
"deprecated": false, "autowired": false, "secret": false, "description": "Sets 
the exchange pattern when the consumer creates an exchange." },
     "allowResponseAttachmentOverride": { "index": 12, "kind": "parameter", 
"displayName": "Allow Response Attachment Override", "group": "producer", 
"label": "producer", "required": false, "type": "boolean", "javaType": 
"boolean", "deprecated": false, "autowired": false, "secret": false, 
"defaultValue": false, "configurationClass": 
"org.apache.camel.component.spring.ws.SpringWebserviceConfiguration", 
"configurationField": "configuration", "description": "Option to override soap 
response  [...]
-    "allowResponseHeaderOverride": { "index": 13, "kind": "parameter", 
"displayName": "Allow Response Header Override", "group": "producer", "label": 
"producer", "required": false, "type": "boolean", "javaType": "boolean", 
"deprecated": false, "autowired": false, "secret": false, "defaultValue": 
false, "configurationClass": 
"org.apache.camel.component.spring.ws.SpringWebserviceConfiguration", 
"configurationField": "configuration", "description": "Option to override soap 
response header i [...]
+    "allowResponseHeaderOverride": { "index": 13, "kind": "parameter", 
"displayName": "Allow Response Header Override", "group": "producer", "label": 
"producer", "required": false, "type": "boolean", "javaType": "boolean", 
"deprecated": false, "autowired": false, "secret": false, "defaultValue": 
false, "configurationClass": 
"org.apache.camel.component.spring.ws.SpringWebserviceConfiguration", 
"configurationField": "configuration", "description": "Option to override soap 
response header i [...]
     "faultAction": { "index": 14, "kind": "parameter", "displayName": "Fault 
Action", "group": "producer", "label": "producer", "required": false, "type": 
"string", "javaType": "java.net.URI", "deprecated": false, "autowired": false, 
"secret": false, "configurationClass": 
"org.apache.camel.component.spring.ws.SpringWebserviceConfiguration", 
"configurationField": "configuration", "description": "Signifies the value for 
the faultAction response WS-Addressing Fault Action header that is pro [...]
     "faultTo": { "index": 15, "kind": "parameter", "displayName": "Fault To", 
"group": "producer", "label": "producer", "required": false, "type": "string", 
"javaType": "java.net.URI", "deprecated": false, "autowired": false, "secret": 
false, "configurationClass": 
"org.apache.camel.component.spring.ws.SpringWebserviceConfiguration", 
"configurationField": "configuration", "description": "Signifies the value for 
the faultAction response WS-Addressing FaultTo header that is provided by the  
[...]
     "messageFactory": { "index": 16, "kind": "parameter", "displayName": 
"Message Factory", "group": "producer", "label": "producer", "required": false, 
"type": "object", "javaType": 
"org.springframework.ws.WebServiceMessageFactory", "deprecated": false, 
"autowired": false, "secret": false, "configurationClass": 
"org.apache.camel.component.spring.ws.SpringWebserviceConfiguration", 
"configurationField": "configuration", "description": "Option to provide a 
custom WebServiceMessageFactory." },
diff --git 
a/components/camel-spring-parent/camel-spring-ws/src/main/java/org/apache/camel/component/spring/ws/SpringWebserviceConfiguration.java
 
b/components/camel-spring-parent/camel-spring-ws/src/main/java/org/apache/camel/component/spring/ws/SpringWebserviceConfiguration.java
index 3a7da5ea2542..123cf22b74a4 100644
--- 
a/components/camel-spring-parent/camel-spring-ws/src/main/java/org/apache/camel/component/spring/ws/SpringWebserviceConfiguration.java
+++ 
b/components/camel-spring-parent/camel-spring-ws/src/main/java/org/apache/camel/component/spring/ws/SpringWebserviceConfiguration.java
@@ -444,7 +444,9 @@ public class SpringWebserviceConfiguration {
     /**
      * Option to override soap response header in in/out exchange with header 
info from the actual service layer. If the
      * invoked service appends or rewrites the soap header this option when 
set to true, allows the modified soap header
-     * to be overwritten in in/out message headers
+     * to be overwritten in in/out message headers. The names of the soap 
response header attributes and elements are
+     * filtered using the headerFilterStrategy, which by default filters out 
the internal {@code Camel} and
+     * {@code camel} header namespace (case-insensitive).
      */
     public void setAllowResponseHeaderOverride(boolean 
allowResponseHeaderOverride) {
         this.allowResponseHeaderOverride = allowResponseHeaderOverride;
diff --git 
a/components/camel-spring-parent/camel-spring-ws/src/main/java/org/apache/camel/component/spring/ws/SpringWebserviceProducer.java
 
b/components/camel-spring-parent/camel-spring-ws/src/main/java/org/apache/camel/component/spring/ws/SpringWebserviceProducer.java
index 112ac4812130..f31558346062 100644
--- 
a/components/camel-spring-parent/camel-spring-ws/src/main/java/org/apache/camel/component/spring/ws/SpringWebserviceProducer.java
+++ 
b/components/camel-spring-parent/camel-spring-ws/src/main/java/org/apache/camel/component/spring/ws/SpringWebserviceProducer.java
@@ -36,6 +36,7 @@ import org.apache.camel.Exchange;
 import org.apache.camel.Message;
 import org.apache.camel.RuntimeCamelException;
 import org.apache.camel.attachment.AttachmentMessage;
+import org.apache.camel.spi.HeaderFilterStrategy;
 import org.apache.camel.support.DefaultProducer;
 import org.apache.camel.support.ExchangeHelper;
 import org.slf4j.Logger;
@@ -109,10 +110,12 @@ public class SpringWebserviceProducer extends 
DefaultProducer {
                         SoapMessage soapMessage = (SoapMessage) 
responseMessage;
                         if (ExchangeHelper.isOutCapable(exchange)) {
                             
exchange.getOut().copyFromWithNewBody(exchange.getIn(), 
soapMessage.getPayloadSource());
-                            
populateHeaderAndAttachmentsFromResponse(exchange.getOut(AttachmentMessage.class),
 soapMessage);
+                            populateHeaderAndAttachmentsFromResponse(exchange, 
exchange.getOut(AttachmentMessage.class),
+                                    soapMessage);
                         } else {
                             
exchange.getIn().setBody(soapMessage.getPayloadSource());
-                            
populateHeaderAndAttachmentsFromResponse(exchange.getIn(AttachmentMessage.class),
 soapMessage);
+                            populateHeaderAndAttachmentsFromResponse(exchange, 
exchange.getIn(AttachmentMessage.class),
+                                    soapMessage);
                         }
 
                     }
@@ -122,9 +125,10 @@ public class SpringWebserviceProducer extends 
DefaultProducer {
     /**
      * Populates soap message headers and attachments from soap response
      */
-    private void populateHeaderAndAttachmentsFromResponse(AttachmentMessage 
inOrOut, SoapMessage soapMessage) {
+    private void populateHeaderAndAttachmentsFromResponse(
+            Exchange exchange, AttachmentMessage inOrOut, SoapMessage 
soapMessage) {
         if (soapMessage.getSoapHeader() != null && 
getEndpoint().getConfiguration().isAllowResponseHeaderOverride()) {
-            populateMessageHeaderFromResponse(inOrOut, 
soapMessage.getSoapHeader());
+            populateMessageHeaderFromResponse(exchange, inOrOut, 
soapMessage.getSoapHeader());
         }
         if (soapMessage.getAttachments() != null && 
getEndpoint().getConfiguration().isAllowResponseAttachmentOverride()) {
             populateMessageAttachmentsFromResponse(inOrOut, 
soapMessage.getAttachments());
@@ -132,15 +136,22 @@ public class SpringWebserviceProducer extends 
DefaultProducer {
     }
 
     /**
-     * Populates message headers from soapHeader response
+     * Populates message headers from soapHeader response, applying the 
endpoint's {@link HeaderFilterStrategy} to the
+     * soap header attribute and element names
      */
-    private void populateMessageHeaderFromResponse(Message message, SoapHeader 
soapHeader) {
+    private void populateMessageHeaderFromResponse(Exchange exchange, Message 
message, SoapHeader soapHeader) {
+        HeaderFilterStrategy headerFilterStrategy = 
getEndpoint().getHeaderFilterStrategy();
+
         message.setHeader(SpringWebserviceConstants.SPRING_WS_SOAP_HEADER, 
soapHeader.getSource());
         // Set header values for the soap header attributes
         Iterator<QName> attIter = soapHeader.getAllAttributes();
         while (attIter.hasNext()) {
             QName name = attIter.next();
-            message.getHeaders().put(name.getLocalPart(), 
soapHeader.getAttributeValue(name));
+            Object value = soapHeader.getAttributeValue(name);
+            if (headerFilterStrategy == null
+                    || 
!headerFilterStrategy.applyFilterToExternalHeaders(name.getLocalPart(), value, 
exchange)) {
+                message.getHeaders().put(name.getLocalPart(), value);
+            }
         }
 
         // Set header values for the soap header elements
@@ -148,8 +159,10 @@ public class SpringWebserviceProducer extends 
DefaultProducer {
         while (elementIter.hasNext()) {
             SoapHeaderElement element = elementIter.next();
             QName name = element.getName();
-            message.getHeaders().put(name.getLocalPart(), element);
-
+            if (headerFilterStrategy == null
+                    || 
!headerFilterStrategy.applyFilterToExternalHeaders(name.getLocalPart(), 
element, exchange)) {
+                message.getHeaders().put(name.getLocalPart(), element);
+            }
         }
     }
 
diff --git 
a/components/camel-spring-parent/camel-spring-ws/src/test/java/org/apache/camel/component/spring/ws/ProducerSoapHeaderFilterTest.java
 
b/components/camel-spring-parent/camel-spring-ws/src/test/java/org/apache/camel/component/spring/ws/ProducerSoapHeaderFilterTest.java
new file mode 100644
index 000000000000..c4c2d59c975b
--- /dev/null
+++ 
b/components/camel-spring-parent/camel-spring-ws/src/test/java/org/apache/camel/component/spring/ws/ProducerSoapHeaderFilterTest.java
@@ -0,0 +1,98 @@
+/*
+ * 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.
+ */
+package org.apache.camel.component.spring.ws;
+
+import org.apache.camel.EndpointInject;
+import org.apache.camel.Exchange;
+import org.apache.camel.Message;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.test.spring.junit6.CamelSpringTestSupport;
+import org.junit.jupiter.api.Test;
+import org.springframework.context.support.AbstractXmlApplicationContext;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+import org.springframework.ws.soap.SoapHeaderElement;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertInstanceOf;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertNull;
+
+class ProducerSoapHeaderFilterTest extends CamelSpringTestSupport {
+
+    private final String xmlRequest = "<GetQuote 
xmlns=\"http://www.stockquotes.edu/\";><symbol>GOOG</symbol></GetQuote>";
+
+    @EndpointInject("mock:result")
+    private MockEndpoint result;
+
+    @EndpointInject("mock:resultCustomStrategy")
+    private MockEndpoint resultCustomStrategy;
+
+    @Test
+    void internalCamelAttributeFromResponseSoapHeaderIsFiltered() throws 
Exception {
+        result.expectedMessageCount(1);
+
+        template.requestBody("direct:responseHeaderOverride", xmlRequest);
+
+        result.assertIsSatisfied();
+        Message message = result.getExchanges().get(0).getMessage();
+        // the raw SOAP header and a regular application-level attribute are 
still mapped
+        
assertNotNull(message.getHeader(SpringWebserviceConstants.SPRING_WS_SOAP_HEADER),
+                "The SOAP response header should be propagated");
+        assertEquals("1234567890", message.getHeader("MessageId"),
+                "Application-level SOAP response header attribute should be 
propagated");
+        // attribute names in the internal Camel header namespace are filtered 
out, whatever their case
+        assertNull(message.getHeader(Exchange.HTTP_URI),
+                "Internal Camel* header coming from a SOAP response header 
attribute must be filtered");
+        assertNull(message.getHeader(Exchange.HTTP_QUERY),
+                "Internal Camel* header coming from a SOAP response header 
attribute must be filtered case-insensitively");
+    }
+
+    @Test
+    void internalCamelElementFromResponseSoapHeaderIsFiltered() throws 
Exception {
+        result.expectedMessageCount(1);
+
+        template.requestBody("direct:responseHeaderOverride", xmlRequest);
+
+        result.assertIsSatisfied();
+        Message message = result.getExchanges().get(0).getMessage();
+        // a regular application-level element is still mapped
+        assertInstanceOf(SoapHeaderElement.class, 
message.getHeader("TransactionId"),
+                "Application-level SOAP response header element should be 
propagated");
+        // an element whose local name is in the internal Camel header 
namespace is filtered out
+        assertNull(message.getHeader(Exchange.FILE_NAME),
+                "Internal Camel* header coming from a SOAP response header 
element must be filtered");
+    }
+
+    @Test
+    void customHeaderFilterStrategyIsApplied() throws Exception {
+        resultCustomStrategy.expectedMessageCount(1);
+
+        template.requestBody("direct:responseHeaderOverrideCustomStrategy", 
xmlRequest);
+
+        resultCustomStrategy.assertIsSatisfied();
+        Message message = 
resultCustomStrategy.getExchanges().get(0).getMessage();
+        // the endpoint's own strategy decides, so a strategy that filters 
nothing maps every name
+        assertEquals("http://localhost/other";, 
message.getHeader(Exchange.HTTP_URI),
+                "The headerFilterStrategy configured on the endpoint should be 
applied");
+    }
+
+    @Override
+    protected AbstractXmlApplicationContext createApplicationContext() {
+        return new ClassPathXmlApplicationContext(
+                
"org/apache/camel/component/spring/ws/ProducerSoapHeaderFilterTest-context.xml");
+    }
+}
diff --git 
a/components/camel-spring-parent/camel-spring-ws/src/test/java/org/apache/camel/component/spring/ws/testfilters/ResponseSoapHeaderMessageFilter.java
 
b/components/camel-spring-parent/camel-spring-ws/src/test/java/org/apache/camel/component/spring/ws/testfilters/ResponseSoapHeaderMessageFilter.java
new file mode 100644
index 000000000000..d79ddeb4f1ab
--- /dev/null
+++ 
b/components/camel-spring-parent/camel-spring-ws/src/test/java/org/apache/camel/component/spring/ws/testfilters/ResponseSoapHeaderMessageFilter.java
@@ -0,0 +1,51 @@
+/*
+ * 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.
+ */
+package org.apache.camel.component.spring.ws.testfilters;
+
+import javax.xml.namespace.QName;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.component.spring.ws.filter.MessageFilter;
+import org.springframework.ws.WebServiceMessage;
+import org.springframework.ws.soap.SoapHeader;
+import org.springframework.ws.soap.SoapMessage;
+
+/**
+ * Adds SOAP header attributes and elements to the response of a spring-ws 
consumer, the way an invoked web service may
+ * append to or rewrite the SOAP header of its response.
+ */
+public class ResponseSoapHeaderMessageFilter implements MessageFilter {
+
+    private static final String NAMESPACE = "http://example.com/test";;
+
+    @Override
+    public void filterProducer(Exchange exchange, WebServiceMessage 
produceResponse) {
+        // Do nothing
+    }
+
+    @Override
+    public void filterConsumer(Exchange exchange, WebServiceMessage 
consumerResponse) {
+        SoapHeader soapHeader = ((SoapMessage) 
consumerResponse).getSoapHeader();
+        // regular application-level header attribute and element
+        soapHeader.addAttribute(new QName(NAMESPACE, "MessageId"), 
"1234567890");
+        soapHeader.addHeaderElement(new QName(NAMESPACE, 
"TransactionId")).setText("42");
+        // header attributes and element whose local names are in the internal 
Camel header namespace
+        soapHeader.addAttribute(new QName(NAMESPACE, "CamelHttpUri"), 
"http://localhost/other";);
+        soapHeader.addAttribute(new QName(NAMESPACE, "cAmElHttpQuery"), 
"param=value");
+        soapHeader.addHeaderElement(new QName(NAMESPACE, 
"CamelFileName")).setText("response.xml");
+    }
+}
diff --git 
a/components/camel-spring-parent/camel-spring-ws/src/test/resources/org/apache/camel/component/spring/ws/ProducerSoapHeaderFilterTest-context.xml
 
b/components/camel-spring-parent/camel-spring-ws/src/test/resources/org/apache/camel/component/spring/ws/ProducerSoapHeaderFilterTest-context.xml
new file mode 100644
index 000000000000..73ba1beb66a4
--- /dev/null
+++ 
b/components/camel-spring-parent/camel-spring-ws/src/test/resources/org/apache/camel/component/spring/ws/ProducerSoapHeaderFilterTest-context.xml
@@ -0,0 +1,70 @@
+<?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.
+
+-->
+<beans xmlns="http://www.springframework.org/schema/beans";
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+       xsi:schemaLocation="
+         http://www.springframework.org/schema/beans 
http://www.springframework.org/schema/beans/spring-beans.xsd
+         http://camel.apache.org/schema/spring 
http://camel.apache.org/schema/spring/camel-spring.xsd";>
+
+    <camelContext xmlns="http://camel.apache.org/schema/spring";>
+        <!-- producer routes (web service clients) mapping the SOAP response 
header onto the message -->
+        <route>
+            <from uri="direct:responseHeaderOverride"/>
+            <to 
uri="spring-ws:http://localhost?webServiceTemplate=#webServiceTemplate&amp;soapAction=http://www.stockquotes.edu/GetQuote&amp;allowResponseHeaderOverride=true"/>
+            <to uri="mock:result"/>
+        </route>
+        <route>
+            <from uri="direct:responseHeaderOverrideCustomStrategy"/>
+            <to 
uri="spring-ws:http://localhost?webServiceTemplate=#webServiceTemplate&amp;soapAction=http://www.stockquotes.edu/GetQuote&amp;allowResponseHeaderOverride=true&amp;headerFilterStrategy=#passThroughHeaderFilterStrategy"/>
+            <to uri="mock:resultCustomStrategy"/>
+        </route>
+
+        <!-- consumer route (the actual web service) whose response carries 
SOAP header attributes and elements -->
+        <route>
+            <from 
uri="spring-ws:soapaction:http://www.stockquotes.edu/GetQuote?endpointMapping=#endpointMapping&amp;messageFilter=#responseSoapHeaderMessageFilter"/>
+            <setBody>
+                <constant>&lt;GetQuoteResponse 
xmlns="http://www.stockquotes.edu/"&gt;&lt;GetQuoteResult&gt;100&lt;/GetQuoteResult&gt;&lt;/GetQuoteResponse&gt;</constant>
+            </setBody>
+        </route>
+    </camelContext>
+
+    <bean id="messageFactory" 
class="org.springframework.ws.soap.saaj.SaajSoapMessageFactory"/>
+
+    <bean id="endpointMapping"
+          
class="org.apache.camel.component.spring.ws.bean.CamelEndpointMapping"/>
+
+    <bean id="responseSoapHeaderMessageFilter"
+          
class="org.apache.camel.component.spring.ws.testfilters.ResponseSoapHeaderMessageFilter"/>
+
+    <!-- a header filter strategy that does not filter any inbound header -->
+    <bean id="passThroughHeaderFilterStrategy" 
class="org.apache.camel.support.DefaultHeaderFilterStrategy">
+        <property name="inFilterStartsWith">
+            <null/>
+        </property>
+    </bean>
+
+    <bean id="webServiceTemplate" 
class="org.springframework.ws.client.core.WebServiceTemplate">
+        <property name="defaultUri" value="http://localhost"/>
+        <property name="messageSender">
+            <bean 
class="net.javacrumbs.springws.test.helper.InMemoryWebServiceMessageSender2"/>
+        </property>
+    </bean>
+
+</beans>
diff --git 
a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/SpringWebserviceEndpointBuilderFactory.java
 
b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/SpringWebserviceEndpointBuilderFactory.java
index f6d0d599e17b..929526364422 100644
--- 
a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/SpringWebserviceEndpointBuilderFactory.java
+++ 
b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/SpringWebserviceEndpointBuilderFactory.java
@@ -549,7 +549,10 @@ public interface SpringWebserviceEndpointBuilderFactory {
          * header info from the actual service layer. If the invoked service
          * appends or rewrites the soap header this option when set to true,
          * allows the modified soap header to be overwritten in in/out message
-         * headers.
+         * headers. The names of the soap response header attributes and
+         * elements are filtered using the headerFilterStrategy, which by
+         * default filters out the internal Camel and camel header namespace
+         * (case-insensitive).
          * 
          * The option is a: <code>boolean</code> type.
          * 
@@ -568,7 +571,10 @@ public interface SpringWebserviceEndpointBuilderFactory {
          * header info from the actual service layer. If the invoked service
          * appends or rewrites the soap header this option when set to true,
          * allows the modified soap header to be overwritten in in/out message
-         * headers.
+         * headers. The names of the soap response header attributes and
+         * elements are filtered using the headerFilterStrategy, which by
+         * default filters out the internal Camel and camel header namespace
+         * (case-insensitive).
          * 
          * The option will be converted to a <code>boolean</code> type.
          * 

Reply via email to