Spring Web Services
Exercise: Todo SOAP Service (Contract-first)
The objective of this exercise is to implement a SOAP based todo web service based on a WSDL document.
Assignment
- WSDL document
- Save the WSDL document of the code-first web service to the resource folder
- Extract the type definitions from the WSDL document into a separate XML Schema document
- Change the XML Schema such that the ID is a required attribute of the todos and the title a required non-empty element
- Code generation
- Remove the exception class and rename the entity
Todo to TodoEntity
- Use the Maven plugin
cxf-codegen-plugin to generate the Java artifacts from the local WSDL document (see Apache CXF documentation)
- Service implementation
- Remove all the JAX-WS annotations from the
TodoListImpl class and implement the generated web service interface
- Annotate the class with the
@WebService annotation using the endpointInterface and wsdlLocation elements
- Annotate the class with the
@SchemaValidation annotation to activate XML schema validation
- Use the TypeMapper utility class to convert the occurring date and todo types where necessary
- Testing
Solution