<dependency> <groupId>jakarta.xml.ws</groupId> <artifactId>jakarta.xml.ws-api</artifactId> <version>3.0.0</version> </dependency> <dependency> <groupId>jakarta.xml.ws</groupId> <artifactId>jakarta.xml.bind-api</artifactId> <version>3.0.0</version> </dependency> <dependency> <groupId>org.jboss.spec.javax.xml.ws</groupId> <artifactId>jboss-jaxws-api_2.2_spec</artifactId> <version>1.0.3.Final</version> </dependency> <dependency> <groupId>org.jboss.spec.javax.xml.rpc</groupId> <artifactId>jboss-jaxrpc-api_1.1_spec</artifactId> <version>1.0.1.Final</version> </dependency> import jakarta.jws.WebService; @WebService(name = "ExampleService", targetNamespace = "http://www.example.com/") public class ExampleService { } import jakarta.jws.WebMethod; @WebMethod(operationName = "sayHello", action = "urn:SayHello") public String sayHello(String name) { return "Hello, " + name + "!"; } import jakarta.xml.ws.Endpoint; public class Main { public static void main(String[] args) { String address = "http://localhost:8080/ExampleService"; ExampleService exampleService = new ExampleService(); Endpoint.publish(address, exampleService); System.out.println("Web service published at " + address); } }


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