<dependencies> <dependency> <groupId>javax.jws</groupId> <artifactId>javax.jws-api</artifactId> <version>1.1</version> </dependency> </dependencies> import javax.jws.WebMethod; import javax.jws.WebService; @WebService public class MathLibrary { @WebMethod public int add(int a, int b) { return a + b; } @WebMethod public int subtract(int a, int b) { return a - b; } } import javax.xml.ws.Endpoint; public class MathLibrary { // ... public static void main(String[] args) { String url = "http://localhost:8080/mathlibrary"; Endpoint.publish(url, new MathLibrary()); System.out.println("MathLibrary Web Service running on " + url); } }


上一篇:
下一篇:
切换中文