package wstest.client;
import java.net.MalformedURLException;
import java.util.List;
import org.codehaus.xfire.XFire;
import org.codehaus.xfire.XFireFactory;
import org.codehaus.xfire.client.XFireProxyFactory;
import org.codehaus.xfire.service.Service;
import org.codehaus.xfire.service.binding.ObjectServiceFactory;
import wstest.server.IMyService;
import wstest.server.pojo.Student;
/**
* 一、通过服务端提供的接口类进行调用
* */
public class MyServiceClient1 {
public static void main(String[] args) {
Service serviceModel = new ObjectServiceFactory()
.create(IMyService.class);
XFire xfire = XFireFactory.newInstance().getXFire();
XFireProxyFactory factory = new XFireProxyFactory(xfire);
String serviceUrl = "http://127.0.0.1:8080/xfire126Demo/services/MyService";
IMyService client = null;
try {
client = (IMyService) factory.create(serviceModel, serviceUrl);
} catch (MalformedURLException e) {
System.out.println("Client call webservice has exception: " + e.toString());
}
String result1 = client.sayHello("张三");
List<Student> studentList = (List<Student>)client.getPersons("d");
System.out.println("返回结果:" + result1);
System.out.println("返回个数:" + studentList.size());
for(Student student : studentList) {
System.out.println(student.getName());
System.out.println(student.getJob());
}
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
webservice xfire spring2.0完整实例
共68个文件
jar:40个
xml:5个
class:5个
4星 · 超过85%的资源 需积分: 9 81 下载量 24 浏览量
2010-12-15
13:24:57
上传
评论
收藏 14.82MB RAR 举报
温馨提示
webservice xfire1.2.6 spring2.0完整的代码,包含客户端两种方式(1 接口 2 url)
资源推荐
资源详情
资源评论
收起资源包目录
xfire126Demo.rar (68个子文件)
xfire126Demo
.settings
org.eclipse.wst.jsdt.ui.superType.name 6B
org.eclipse.core.resources.prefs 88B
org.eclipse.wst.jsdt.ui.superType.container 49B
com.genuitec.eclipse.ws.xfire.prefs 145B
.jsdtscope 500B
com.genuitec.eclipse.ws.prefs 109B
src
log4j.properties 1KB
wstest
client
MyServiceClient1.java 1KB
MyServiceClient2.java 670B
server
IMyService.java 275B
pojo
Student.java 329B
MyServiceImpl.java 801B
applicationContext.xml 927B
.project 2KB
WebRoot
META-INF
MANIFEST.MF 36B
WEB-INF
web.xml 1KB
classes
META-INF
xfire
services.xml 618B
log4j.properties 1KB
wstest
client
MyServiceClient2.class 1KB
MyServiceClient1.class 3KB
server
IMyService.class 395B
pojo
Student.class 713B
MyServiceImpl.class 2KB
applicationContext.xml 927B
lib
xercesImpl-2.6.2.jar 987KB
bcprov-jdk15-133.jar 1.02MB
jetty-6.1.2rc0.jar 451KB
commons-codec-1.3.jar 46KB
commons-logging-1.0.4.jar 37KB
jaxb-xjc-2.0.1.jar 2.85MB
spring.jar 2.81MB
commons-beanutils-1.7.0.jar 184KB
saaj-api-1.3.jar 18KB
xfire-all-1.2.6.jar 883KB
wss4j-1.5.1.jar 529KB
jsr173_api-1.0.jar 49KB
servlet-api-2.5-6.1.2rc0.jar 129KB
jaxen-1.1-beta-9.jar 227KB
jetty-util-6.1.2rc0.jar 120KB
xml-apis-1.0.b2.jar 107KB
mail-1.4.jar 380KB
junit-3.8.1.jar 118KB
saaj-impl-1.3.jar 268KB
XmlSchema-1.1.jar 125KB
servlet-api-2.3.jar 76KB
activation-1.1.jar 62KB
opensaml-1.0.1.jar 103KB
wstx-asl-3.2.0.jar 493KB
stax-utils-20040917.jar 111KB
jaxb-api-2.0.jar 71KB
jdom-1.0.jar 150KB
commons-attributes-api-2.1.jar 35KB
jmock-1.0.1.jar 68KB
xfire-jsr181-api-1.0-M1.jar 8KB
xbean-2.2.0.jar 2.54MB
commons-discovery-0.2.jar 70KB
log4j-1.2.15.jar 383KB
jaxws-api-2.0.jar 23KB
commons-httpclient-3.0.jar 273KB
xmlsec-1.3.0.jar 278KB
wsdl4j-1.6.1.jar 145KB
jaxb-impl-2.0.1.jar 768KB
stax-api-1.0.1.jar 26KB
xbean-spring-2.8.jar 175KB
index.jsp 831B
WebServices
services.xml 618B
.mymetadata 309B
.classpath 3KB
.myeclipse
共 68 条
- 1
lostlong
- 粉丝: 0
- 资源: 10
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
- 1
- 2
前往页