web service简单实例。myEclipse8.5。XFire
有兴趣的,可以加我QQ:245308557
一。服务器
XFire的
1创建web service project .会自动生成services.xml文件,用于配置。
方法随便写
如:
二。客户端。
1。创建一个 web service client 。地址是。工程名称/services/webOne
或者工程名称/services/webTwo 这个webOne和webTwo是services.xml里配置的名称,可以随便写。services是创建服务器端时的路径,默认是它,创建服务器端时,可自己随便写。。
2.
客户端代码public class webTwo {public static void main(String[] args) {webTwo_toOne();webTwo_toTwo();}public static void webTwo_toOne(){//生成的webTwoClient 和webTwoPortType 比较重要。// 在创建客户端时,就是web service client时,自己new几个包。//不要和服务器的包名相同,自然就会明白了....webTwoClient webc = new webTwoClient();webTwoPortType webp = webc.getwebTwoHttpPort();String s = webp.webTwo_toOne("webTwo Method One!");System.out.println(s);}public static void webTwo_toTwo(){webTwoClient webc = new webTwoClient();webTwoPortType webp = webc.getwebTwoHttpPort();String s = webp.webTwo_toTwo("webTwo Method Two!");System.out.println(s);}}