一个简单的webService程序

package webservice;

import javax.jws.WebService;
import javax.xml.ws.Endpoint;

@WebService
public class TestWebservice {
	
	
	public String getValue(String name){
		return "my name is :"+name;
	}
	
	public static void main(String[] args) {
		Endpoint.publish("http://localhost:9001/test/TestWebservice", new TestWebservice());
		System.out.println("webservice success!");
	}
}


直接把代码copy到myeclipse运行就可以了,启动后,在浏览器访问:

http://localhost:9001/test/TestWebservice?wsdl

效果如下











你可能感兴趣的:(Webservice)