Issue
I'm trying to migrate some legacy SOAP services from one application (Spring WebMVC, Boot, Tomcat) to other (Spring WebFlux, Boot, Netty). Those services are written using Apache CXF.
So in the original project, they used to work fine, and the following configuration was used:
// imports
@Configuration
public class SoapWebServiceConfig {
@Bean(name = "cxf")
public SpringBus springBus() {
var loggingFeature = new LoggingFeature();
loggingFeature.addSensitiveProtocolHeaderNames(Set.of("Server", "Accept", "Date"));
loggingFeature.setPrettyLogging(true);
var springBus = new SpringBus();
springBus.getFeatures().add(loggingFeature);
return springBus;
}
@Bean
public ActivateGateway activateGateway() {
return new ActivateGatewayImpl();
}
@Bean
public Endpoint activateGatewayEndpoint(Bus bus, ActivateGateway activateGateway) {
EndpointImpl endpoint = new EndpointImpl(bus, activateGateway);
endpoint.publish("/activateGateway");
return endpoint;
}
@Bean
public CDACloudCommunicationPortType cdaCloudCommunicationPortType() {
return new CloudCommunicationPortTypeImpl();
}
@Bean
public Endpoint cdaCloudCommunicationEndpoint(Bus bus, CDACloudCommunicationPortType cdaCloudCommunicationPortType) {
EndpointImpl endpoint = new EndpointImpl(bus, cdaCloudCommunicationPortType);
endpoint.publish("/controldata");
return endpoint;
}
@Primary
@Bean(name = "cxfServletRegistration")
public ServletRegistrationBean<CXFServlet> cxfServletRegistration() {
ServletRegistrationBean<CXFServlet> servletRegistrationBean = new ServletRegistrationBean<>(
new CXFServlet(), "/daas/activate/*", "/daas/controldata/*");
servletRegistrationBean.setLoadOnStartup(1);
return servletRegistrationBean;
}
}
It created a servlet which worked fine alongside DispatcherServlet I suppose (I'm not the author of this code).
But when I moved this configuration to WebFlux, I cannot reach any of these endpoints, for example GET /daas/activate/activateGateway?wsdl
gets mapped to some ResourceWebHandler, but not to CXFServlet.
Maybe I'm missing something and in WebFlux it's done differently.
UPD: It seems like the reactive stack doesn't use servlets. Then the question is - what is used to implement SOAP services on top of reactive stack? Is there a possibility?
Solution
Webflux doesn't rely on servlet. I don't actually think it is possible to connect CXF with webflux.
Answered By - grekier
Answer Checked By - Mary Flores (JavaFixing Volunteer)