Soap Webservices have been around for a while now. A Soap webservice consists of two parts; the WSDL which is basically the contract describing the interface, and the Endpoint which is the class where the call eventually ends up.
In Java there are a few ways of setting up a Soap webservice. You could write the WSDL and generate the server code from there. Writing WSDL documents by hand is a pain though and should be avoided if at all possible.
Through this tutorial, I would like to explain a cleaner method with the help of XSD files and Maven. Using XSD and Maven to create a SoapWebservice follows a few steps:
- Create the XSDs, these descibe the data objects in the webservice
- Setup Maven to generate the Java data objects
- Run Maven to actually create the Java data objects
- Write the Webservice endpoint class
- Deploy the application to a webserver
- Call the webservice to have the webservice create the WSDL for you
You could also have Maven create the WSDL for you. This would be usefull if you also need to create the Client side of the Soap service.
This tutorial will lead you through the setup of a maven project. This maven project will then be used to build up a Contract-First webservice. Eventually restrictions will be added and enforced and you will learn how to add inheritance to the generated classes.
This tutorial continuous in the next part of the series, SOAP webservices with Maven, Project Setup