we are migrating Camel from 3 to currently latest version 4.4.1. Of course all required updated were done as well, like Spring Boot 3...
We are using CXF library in our route builder code to send SOAP request:
.to("cxf:bean:soapClient")
When the route is executed we see an error "Received RST_STREAM: Stream cancelled".
soapClient is CxfEndpoint, as seen below:
@Bean(name = "soapClient")
public CxfEndpoint soapClient(
@Value("${service.url}") final String serviceUrl,
@Qualifier("cDataInterceptor") CDataWriterInterceptor cDataWriterInterceptor,
@Qualifier("encodingInterceptor") EncodingInterceptor encodingInterceptor,
@Qualifier("signatureOutInterceptor") WSS4JOutInterceptor signatureOutInterceptor) throws ClassNotFoundException {
CxfEndpoint cxfEndpoint = new CxfEndpoint();
cxfEndpoint.setAddress(serviceUrl);
cxfEndpoint.setServiceClass("com.MyClass");
cxfEndpoint.setOutInterceptors(List.of(cDataWriterInterceptor, encodingInterceptor, signatureOutInterceptor));
return cxfEndpoint;
ly}
If I remove signatureOutInterceptor from interceptor list, call will succeed.
@Bean(name = "signatureOutInterceptor")
public WSS4JOutInterceptor signatureOutInterceptor(
@Qualifier("clientPasswordCallback") ClientPasswordCallback clientPasswordCallback,
@Qualifier("signingCryptProperties") Properties signingCryptProperties,
@Value("${keystore.alias}") final String signatureUser
) {
Map<String, Object> properties = new HashMap<>();
properties.put(WSHandlerConstants.ACTION, "Signature Timestamp");
properties.put(WSHandlerConstants.PW_CALLBACK_REF, clientPasswordCallback);
properties.put(WSHandlerConstants.SIGNATURE_USER, signatureUser);
properties.put(WSHandlerConstants.SIG_KEY_ID, "DirectReference");
properties.put(WSHandlerConstants.USE_SINGLE_CERTIFICATE, "false");
properties.put(WSHandlerConstants.SIGNATURE_PARTS, "{Element}{http://schemas.xmlsoap.org/soap/envelope/}Body;\n" +
"{Element}{http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd}Timestamp;\n" +
"{Element}{http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd}BinarySecurityToken");
properties.put(WSHandlerConstants.SIG_ALGO, "http://www.w3.org/2000/09/xmldsig#rsa-sha1");
properties.put(WSHandlerConstants.SIG_PROP_REF_ID, "signatureProperties");
properties.put("signatureProperties", signingCryptProperties);
return new WSS4JOutInterceptor(properties);
}
@Bean(name = "signingCryptProperties")
public Properties signingCryptProperties(
@Value("${env}") final String env,
@Value("${keystore.type}") final String keystoreType,
@Value("${keystore.password}") final String password,
@Value("${keystore.alias}") final String alias
) {
Properties signingCryptPropertiesMap = new Properties();
signingCryptPropertiesMap.put("org.apache.ws.security.crypto.provider", "org.apache.ws.security.components.crypto.Merlin");
signingCryptPropertiesMap.put("org.apache.ws.security.crypto.merlin.keystore.file", "truststore/" + env + "/truststore.jks");
signingCryptPropertiesMap.put("org.apache.ws.security.crypto.merlin.keystore.type", keystoreType);
signingCryptPropertiesMap.put("org.apache.ws.security.crypto.merlin.keystore.password", password);
signingCryptPropertiesMap.put("org.apache.ws.security.crypto.merlin.keystore.alias", alias);
return signingCryptPropertiesMap;
}
@Bean(name = "clientPasswordCallback")
public ClientPasswordCallback clientPasswordCallback(
@Value("${keystore.password}") final String keystorePass
) {
return new ClientPasswordCallback(keystorePass);
}
What would change in Camel or CXF to cause this?