Overview
JAX-WS Spring Jakarta is an open-source library that enables developers to build SOAP services in Spring and Spring Boot using the Bottom-Up approach. While the Top-Down method is often highlighted in official guides and blogs, Bottom-Up can be equally effective when handled carefully — and often more developer-friendly.
Background
This project modernizes the legacy jaxws-spring library, originally last updated in 2013, to work seamlessly with Spring Boot 3, Java 17, and the Jakarta namespace. With it, you can annotate your service classes using @WebService, @WebParam, and @WebResult, then configure bindings with a simple Spring configuration class. No need to manually define WSDL or XSD upfront — just write your service code and expose it as a SOAP endpoint.
Getting Started
<dependency>
<groupId>dev.ercan</groupId>
<artifactId>jaxws-spring-jakarta</artifactId>
<version>4.0.5</version>
</dependency>
Code Example
Service Implementation
@WebService(targetNamespace = "https://ercan.dev/poc/soap-producer-bottom-up/calculator")
public class CalculatorService {
@WebResult(name = "response")
public SumResult sum(@WebParam(name = "request") SumRequest request) {
SumResult response = new SumResult();
response.setResult(request.getNumber1() + request.getNumber2());
return response;
}
// subtract, multiply, divide methods omitted for brevity
}
Configuration
@Bean
public ServletRegistrationBean<SoapServiceServlet> SoapServiceServlet() {
SoapServiceServlet soapWsServlet = new SoapServiceServlet();
ServletRegistrationBean<SoapServiceServlet> bean = new ServletRegistrationBean<>(soapWsServlet);
bean.setLoadOnStartup(1);
return bean;
}
@Bean
public CalculatorService calculatorService() {
return new CalculatorService();
}
@Bean
public SoapServiceBinding calculatorServiceBinding(CalculatorService calculatorService) throws Exception {
SoapServiceFactory soapServiceFactory = new SoapServiceFactory();
soapServiceFactory.setBean(calculatorService);
SoapServiceBinding soapServiceBinding = new SoapServiceBinding();
soapServiceBinding.setUrl("/SOAP/CalculatorService");
soapServiceBinding.setService(soapServiceFactory.getObject());
return soapServiceBinding;
}
Key Features
- Bottom-Up SOAP service creation with Spring Boot
- Compatible with Jakarta namespace (Java 17+, Spring Boot 3+)
- Simple annotation-driven service definitions
- Lightweight configuration with
SoapServiceFactoryandSoapServiceBinding - Open-source and actively maintained
License
This project is licensed under the MIT License.
Contributing
Contributions are welcome! Please open issues or submit pull requests via GitHub.