As reactive becoming more used by developers in order to get performance advantages, you will still need to deal with legacy systems.
There are still many soap web services being used today. If you want to consume soap services with Spring Reactor WebFlux, here is the example.
https://github.com/gungor/spring-webclient-soap.git
If you can consume Rest services using Json, it is not a big deal consuming soap.
Generated JAXB classes needs to be enclosed by Soap envelope.
Therefore we need an encoder class. We also need a decoder class in order to unmarshal received xml into desired JAXB object.
Below is the encode method of Jaxb2SoapEncoder class which you can find in the Git repository. I have modifed Jaxb2XmlEncoder minimally to make a soap envelope
from the JAXB object. JAXB classes are generated by jaxb2-maven-plugin of org.codehaus.mojo.
With Jaxb2SoapEncoder, we can handle how request is sent through webflux.
Below is decode method of Jaxb2SoapDecoder.
Jaxb2SoapDecoder helps in casting to expected object from before it returns to webflux.
Jaxb2SoapEncoder and Jaxb2SoapDecoder classes must be added to WebClient config as below.
When calling WebClient retrieve used instead of exchange since error handling is better using retrieve. If no HTTP status error occurred,
response is mapped to JAXB Response.