The wsdl2java tool's -server
flag causes the tool to generate a simple server mainline. The generated server mainline, as shown in Example 6.1, “Generated Server Mainline”, publishes one endpoint for each port
defined in the WSDL contract.
Example 6.1, “Generated Server Mainline” shows a generated server mainline.
Example 6.1. Generated Server Mainline
package org.apache.hello_world_soap_http; import javax.xml.ws.Endpoint; public class GreeterServer { protected GreeterServer() throws Exception { System.out.println("Starting Server"); Object implementor = new GreeterImpl(); String address = "http://localhost:9000/SoapContext/SoapPort"; Endpoint.publish(address, implementor); } public static void main(String args[]) throws Exception { new GreeterServer(); System.out.println("Server ready..."); Thread.sleep(5 * 60 * 1000); System.out.println("Server exiting"); System.exit(0); } }
The code in Example 6.1, “Generated Server Mainline” does the following: