代码:
package com.zzj.app;
import javax.jws.WebService;
import javax.xml.ws.Endpoint;
@WebService
public class HelloWorldService {
public String sayHello(String name){
return "Hello " + name + "!";
}
public static void main(String[] args) {
Endpoint.publish("http://localhost:8888/helloWorld", new HelloWorldService());
System.out.println("发布成功!");
}
}
运行程序:
WSDL访问地址:http://localhost:8888/helloWorld?wsdl