Spring Boot Micro-Service - SOAP

Yes, I read right , you can use spring boot to create SOAP base services. Actually you can expose the service implementation both as REST & SOAP. It just need a small tweak to your existing REST service. This small tweak will enable existig REST service to be exposed as SOAP services as well.

Follow the below steps to achieve the same
  • Add the following dependency in your pom.xml
  • Create a new Implementation of service as below (service performing addition of 2 numbers). Your main service class & RestController class remains same.
@WebService(portName = "AddPort", name = "AddEndpoint", serviceName = "AddService", targetNamespace = "http://jp.com/add/ws")
public class AddServiceSOAPImpl
    //<editor-fold defaultstate="collapsed" desc="Logger">
    private final Logger logger = LoggerFactory.getLogger(AddServiceImpl.class);

    public AddServiceResponse sum(@WebParam(name = "addServiceRequest") AddServiceRequest addServiceRequest)
        logger.info("Recieved two numbers --> {},{}", addServiceRequest.getNumberOne(), addServiceRequest.getNumberTwo());
        int sum = addServiceRequest.getNumberOne() + addServiceRequest.getNumberTwo();
        AddServiceResponse addServiceResponse = new AddServiceResponse();
        logger.debug("Sum of two numbers is hahah--> " + sum);
        logger.info("Sum of two numbers is --> " + sum);
        return addServiceResponse;
  • Introduce a new class by the name WebServiceConfig.java. This class is responsible for bootstrapping SOAP end point
public class WebServiceConfig

    private Bus bus;

    private AddServiceSOAPImpl addServiceSOAPImpl;

    public Endpoint endpoint()
        EndpointImpl endpoint = new EndpointImpl(bus, addServiceSOAPImpl);
        return endpoint;
  • Run the service & access WSDL - http://localhost:8080/services/v1/

Any queries relating this topic, do write comments below & I will help you developing the same

Spring Boot SOAP Webservice SOAP WSDL REST & SOAP Spring Boot as SOAP

You May Also Enjoy

Microservices Features

Spring Boot Micro-Service - SOAP

Dialogue & Discussion