Service section
Create a new Dynamic Web project under Eclipse
Create a new service class in the project
Writing code for the SayHello class
PackageOrg.sunny.service;//don't quote the wrong bag.ImportJavax.jws.WebService;ImportJavax.xml.ws.Endpoint;//Annotations@WebService no less .@WebService Public classSayHello {//The method is called by the client, and the method name is arbitrary Publicstring Say (string name) {return"Hello" + name + ", this is Sayhelloservice!" ; } Public Static voidMain (string[] args) {//The first parameter is the url,9091 that is accessed when any one of the ports is not occupiedEndpoint.publish ("Http://localhost:9091/Service/SayHello",NewSayHello ()); System.out.println ("Service Success!"); }}
To test: Right-click on any of the blanks
Or
The main method in the class is called after it is run
The following configuration of the results of the operation indicates a successful publication
To load a project into Tomcat
Start Tomcat
Visit webpage: http://localhost:9091/Service/SayHello?wsdl
Note: '? wsdl ' is required to be added.
The following page appears to indicate a successful publication
Client part to be updated tomorrow
Develop a simple web Service under Eclipse