ffang commented on code in PR #4758:
URL: https://github.com/apache/camel-quarkus/pull/4758#discussion_r1164252708
##########
integration-test-groups/cxf-soap/cxf-soap-ws-security-server/src/main/java/org/apache/camel/quarkus/component/cxf/soap/securitypolicy/server/it/WsSecurityPolicyServerRoutes.java:
##########
@@ -19,20 +19,25 @@
import jakarta.enterprise.context.ApplicationScoped;
import jakarta.enterprise.inject.Produces;
import jakarta.inject.Named;
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.cxf.jaxws.CxfEndpoint;
import org.apache.cxf.ext.logging.LoggingFeature;
+import org.apache.cxf.headers.Header;
@ApplicationScoped
public class WsSecurityPolicyServerRoutes extends RouteBuilder {
@Override
public void configure() {
- from("cxf:bean:wsSecurityPolicyHelloService?dataFormat=POJO")
- .log("exchange: ${exchange}")
- .setBody(exchange -> "Secure good morning " +
exchange.getMessage().getBody(String.class));
-
+
from("cxf:bean:wsSecurityPolicyHelloService?dataFormat=POJO").process(new
Processor() {
+ public void process(final Exchange exchange) throws Exception {
+ exchange.getIn().removeHeader(Header.HEADER_LIST);
Review Comment:
Hi @ppalaga ,
HEADER_LIST in Camel message is from the CXF message out-of-band soap
headers(out-of-band means the soap headers are not in the wsdl operation
definition, and the ws-security related soap headers are out-of-band ones).
The problem is that, as the test simply verify the camel-cxf consumer
endpoint with ws-security checks and then in the camel router itself it set the
response body, and in camel-cxf, "SOAP headers are propagated to and from Camel
Message headers", so for the returned CXF message, we need to ensure we remove
unnecessary HEADER_LIST from camel message before creating soap
message(CxfHeaderFilterStrategy can do the similar work but in this test a
simple removeHeader should be sufficient).
The original error is that the incoming ws-security headers was sent back
with outgoing cxf message, that's why we see double Timestamps, actually, it
was worse as it sent back everything back from incoming ws-security headers(the
saml2 token, the encrytion, the signature, etc)
--
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]