Creating WSDL for ZwiftBooks
Since we’ve already created a REST web service for getting price/time quotes for our clients, now it’s time to create a WSDL description of that service that programs can use. By default, most WSDL tools generate SOAP bindings, so that’s the route we’ll follow here. In the early days of WSDL, the only way to write a WSDL description was by hand—a very painful proposition. Now all the heavy lifting can be done with tools such as Java2WSDL from Apache Axis or wscompile from Sun’s JAX-RPC package.
In this example, we’ll step through WSDL generation using Java2WSDL from Apache Axis. Then we’ll go beyond WSDL generation and look at how to generate both client and server code automatically to handle SOAP communication on both sides of a connection.
To run Java2WSDL and its companion, WSDL2Java, you’ll need to have Java installed on your machine; then download the zip file that contains all the required .jar files that need to be in your CLASSPATH.
Figure 3 illustrates the process of generating WSDL by using the Apache Axis toolkit. Although we’re talking Java here, it’s important to note that we’re starting with just an interface, not an implementation. The actual code that actually implements the web service may be written in any language.
Figure 3 Freely available tools support auto-generation of WSDL from interface descriptions, along with web services client and server code from WSDL.