读书人

XFIRE_WEBSERVICES范例

发布时间: 2012-08-21 13:00:21 作者: rapoo

XFIRE_WEBSERVICES实例

服务器端

?

接口

?

?

?

客户端调用

package com.client;import java.net.MalformedURLException;import org.codehaus.xfire.XFireFactory;import org.codehaus.xfire.client.XFireProxyFactory;import org.codehaus.xfire.service.Service;import org.codehaus.xfire.service.binding.ObjectServiceFactory;public class Client {public static void main(String[] args) {String webserviceUrl="http://localhost:8083/webservice/services/test";Service serv=new ObjectServiceFactory().create(IInfo.class);    XFireProxyFactory xfile=new XFireProxyFactory(XFireFactory.newInstance().getXFire());    IInfo info=null;    try{info = (IInfo)xfile.create(serv, webserviceUrl);String hello=info.sayHello("hello");System.out.println(hello);    }catch(MalformedURLException e){}}}

?

?

?

?

详见附件,有疑问可以加我QQ:739921140

读书人网 >Web前端

热点推荐