top of page

Subscribe to Wisdom

Thanks for Subscribing!

  • Writer's picturePuru Uttam

Spring Boot Microservice - 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 existing 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 = "")
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)
{"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);
addServiceResponse.setResponseStatus(ResponseStatus.SUCCESS.value);"Sum of two numbers is --> " + sum);
return addServiceResponse;

  • Introduce a new class by the name 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

15 views0 comments

Recent Posts

See All


Modern Digital Watch
bottom of page