1.所用环境:MyEclipse8.5 +jdk1.6 。注意:并没有用到web容器
2.
@WebService(serviceName = "HelloWorldService", targetNamespace = "http://www.iteasy.cn")
@SOAPBinding(style = SOAPBinding.Style.RPC)
public class HelloWorldService {
@WebMethod
public String sayHello(String name) {
System.out.println("hello " + name);
return "hello " + name;
}
public static void main(String[] args) {
Endpoint.publish("http://localhost:8089/MyWebService", new HelloWorldService());
}
}
刚开始我没有加“@SOAPBinding(style = SOAPBinding.Style.RPC)”,就报了如下错误:
Exception inthread "main" com.sun.xml.internal.ws.model.RuntimeModelerException:runtime modeler error: Wrapper class webservice.jaxws.Echo is not found. Haveyou run APT to generate them?
后来,又试过 网上说的方法,“解决办法是使用apt编译 apt (类路径)/类名.java”,很悲催的是一点都不好用
最终了解到原来是我用自带的jdk版本1.6.0_13,版本不支持,当我改用自己装的jdk1.6.0_21就没有问题了
3.运行HelloWorldService类即发布成功,效果可以在
点击该浏览器,