What to do

At first, set up your pom.xml file. Besides stuff for Spring Boot, you’ll include jaxws-rt (the runtime) and jaxws-spring (a helper library for integrating jaxws-rt with Spring). Exclude the Spring dependencies from jaxws-spring to avoid conflicts. You will also need the jaxws-maven-plugin to help you generate the service classes.

Next, you want to create the service contract by defining the Web Service (WSDL) and Type Definitions (XSD). If you don’t know how to read WSDL documents, here is an excellent introduction.

Run mvn clean compile to generate the Service API. You should see in the target/generated-sources/wsimport folder the service interface and type classes.

The Application class is the main entry to your application. As you’ll see, you will import an xml config file (jaxwsconfig.xml) which contains bean wiring for JAX-WS RI. Also, you need to register WSSpringServlet to receive incoming requests.

The GreetingServiceImpl class implements the web service. It references the service endpoint interface which tells the JAX-WS runtime to use it as an explicit interface (read more about SEIs here). Through the @Component annotation you can make sure it gets picked up, added to the Spring context and will be given a name. You will reference the service by the name later to let it handle the web service requests.

Lastly, you have to add an xml file for wiring the service on the endpoint: