oscerd commented on code in PR #24030:
URL: https://github.com/apache/camel/pull/24030#discussion_r3413813932
##########
components/camel-spring-parent/camel-spring-ws/src/main/java/org/apache/camel/component/spring/ws/SpringWebserviceConfiguration.java:
##########
@@ -420,6 +424,19 @@ public void setMessageIdStrategy(MessageIdStrategy
messageIdStrategy) {
this.messageIdStrategy = messageIdStrategy;
}
+ public HeaderFilterStrategy getHeaderFilterStrategy() {
+ return headerFilterStrategy;
+ }
+
+ /**
+ * To use a custom HeaderFilterStrategy to filter headers mapped to and
from the Camel message. By default the
+ * internal {@code Camel*} and {@code org.apache.camel.*} header namespace
is filtered out from inbound SOAP
+ * headers.
+ */
+ public void setHeaderFilterStrategy(HeaderFilterStrategy
headerFilterStrategy) {
+ this.headerFilterStrategy = headerFilterStrategy;
+ }
+
public boolean isAllowResponseHeaderOverride() {
return allowResponseHeaderOverride;
Review Comment:
Applied — updated the javadoc to reference the `Camel` / `camel`
(case-insensitive) namespace, matching `CAMEL_FILTER_STARTS_WITH`. Thanks for
the catch. — Claude Code on behalf of Andrea Cosentino
##########
components/camel-spring-parent/camel-spring-ws/src/test/java/org/apache/camel/component/spring/ws/ConsumerSoapHeaderFilterTest.java:
##########
@@ -0,0 +1,87 @@
+/*
+ * 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 java.io.StringReader;
+
+import javax.xml.namespace.QName;
+import javax.xml.transform.Source;
+import javax.xml.transform.stream.StreamSource;
+
+import org.apache.camel.EndpointInject;
+import org.apache.camel.Exchange;
+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.client.core.SourceExtractor;
+import org.springframework.ws.client.core.WebServiceTemplate;
+import org.springframework.ws.soap.SoapHeader;
+import org.springframework.ws.soap.SoapMessage;
+
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertNull;
+
+public class ConsumerSoapHeaderFilterTest extends CamelSpringTestSupport {
+
+ private static final SourceExtractor<Object> NOOP_SOURCE_EXTRACTOR =
source -> null;
+
+ private final String xmlRequest = "<GetQuote
xmlns=\"http://www.stockquotes.edu/\"><symbol>GOOG</symbol></GetQuote>";
+
+ @EndpointInject("mock:result")
+ private MockEndpoint result;
+
+ private WebServiceTemplate webServiceTemplate;
+
+ @Override
+ public void doPostSetup() {
+ webServiceTemplate = applicationContext.getBean("webServiceTemplate",
WebServiceTemplate.class);
+ }
+
+ @Test
+ public void internalCamelHeaderFromInboundSoapHeaderIsFiltered() throws
Exception {
+ result.expectedMessageCount(1);
+
+ Source source = new StreamSource(new StringReader(xmlRequest));
+ webServiceTemplate.sendSourceAndReceive(source, message -> {
+ SoapMessage soap = (SoapMessage) message;
Review Comment:
Good catch — added `internalCamelAttributeFromInboundSoapHeaderIsFiltered`
covering the `getAllAttributes` path: a `CamelFileName` attribute is asserted
filtered while a normal attribute is still propagated. — Claude Code on behalf
of Andrea Cosentino
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]