Java6 WebService聞喘鹸墫斤?
扮寂:2011-02-07 51cto鴬人 leizhimin
鹸墫斤?辛燕幣議囂吶曳酒汽斤?膿寄載謹?宸戦心心壓Java6議WebService嶄泌採聞喘鹸墫斤?歌方。
宸戦議歌方蛍曾窃?匯窃頁秘歌?匯窃頁卦指峙。
鹸墫斤?壓旺音???嶄椎担酒汽?凪嶄珊嗤匯乂傲字。萩心糞箭?
1、蝕窟捲暦?由由壓捲暦極
package lavasoft.server;
import javax.jws.WebService;
import javax.xml.ws.Endpoint;
/**
* Java6蝕窟議WebService捲暦極
*
* @author leizhimin 2009-11-16 10:24:13
*/
@WebService
public class Java6WS {
//卦指匯倖鹸墫斤?
public UserBean doSomething1(String username, String address, boolean flag) {
return new UserBean(username, address, flag);
}
//俊辺匯倖鹸墫斤?
public String doSomething2(Foo foo) {
return foo.toString();
}
public static void main(String[] args) {
//窟下匯倖WebService
Endpoint.publish("http://192.168.14.117:9999/java6ws/Java6WS", new Java6WS());
}
}
package lavasoft.server;
/**
* 喘薩佚連
*
* @author leizhimin 2009-11-16 16:43:35
*/
public class UserBean {
private String username;
private String address;
private boolean flag;
public UserBean() {
}
public UserBean(String username, String address, boolean flag) {
this.username = username;
this.address = address;
this.flag = flag;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public boolean isFlag() {
return flag;
}
public void setFlag(boolean flag) {
this.flag = flag;
}
@Override
public String toString() {
return "UserBean{" +
"username=''" + username + ''\'''' +
", address=''" + address + ''\'''' +
", flag=" + flag +
|