现在的位置: 首页 > 综合 > 正文

webservice-jws

2013年03月17日 ⁄ 综合 ⁄ 共 524字 ⁄ 字号 评论关闭

@WebService
public class Hello {

public int counter = 0;
public int getCounter() {
return counter;
}
public void setCounter(int counter) {
this.counter = counter;
}
@WebMethod
public String sayHello(String name){
return "hello "+name;
}
@WebMethod
public int getCounterBy(int num){
setCounter(num);

try {
Thread.sleep(5000);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return getCounter();
}
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
Endpoint.publish("http://localhost:8088/hello", new Hello());
}
}

【上篇】
【下篇】

抱歉!评论已关闭.