package com.exigen.www.client;
import java.net.MalformedURLException;
import java.net.URL;
import org.codehaus.xfire.annotations.AnnotationServiceFactory;
import org.codehaus.xfire.client.Client;
import org.codehaus.xfire.client.XFireProxyFactory;
import org.codehaus.xfire.service.Service;
import org.codehaus.xfire.service.binding.ObjectServiceFactory;
import com.sun.xfire.HelloWorldService;
public class HelloWorldClient {
/**
* @param args
* @throws Exception
*/
public static void main(String[] args) throws Exception {
dynamicClientTest();
knownInterfaceClientTest();
}
/**
* 服务提供者告诉你interface
* @throws MalformedURLException
*/
public static void knownInterfaceClientTest() throws MalformedURLException{
Service serviceModel = new ObjectServiceFactory().create(HelloWorldService.class);
HelloWorldService helloWorldService = (HelloWorldService)new XFireProxyFactory().create(serviceModel,
"http://localhost:8080/xfire/services/HelloWorldService");
System.out.println(helloWorldService.sayHello());
System.out.println("============================");
/*Service serviceModel1 = new AnnotationServiceFactory().create(HelloWorldService.class);
HelloWorldService client = (HelloWorldService)
new XFireProxyFactory().create(serviceModel1,
"http://localhost:8080/xfire/services/HelloWorldService");
System.out.println(client.sayHello());*/
}
/**
* 通过WSDL创建一个动态的客户端
* @throws MalformedURLException
* @throws Exception
*/
public static void dynamicClientTest() throws MalformedURLException, Exception{
Client client = new Client(new URL("http://localhost:8080/xfire/services/HelloWorldService?wsdl"));
Object[] results = client.invoke("sayHello", new Object[]{});
System.out.println(results[0]);
System.out.println("============================");
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
xfire-webservice实例.zip (32个子文件)
xfire
.project 1KB
.mymetadata 288B
src
com
exigen
www
client
HelloWorldClient.java 2KB
sun
xfire
impl
HelloWorldServiceImpl.java 470B
HelloWorldService.java 345B
META-INF
.svn
tmp
props
prop-base
text-base
props
entries 193B
prop-base
text-base
xfire
.svn
tmp
props
prop-base
text-base
props
entries 340B
prop-base
text-base
services.xml.svn-base 410B
services.xml 730B
WebRoot
WEB-INF
classes
com
exigen
www
client
HelloWorldClient.class 2KB
sun
xfire
impl
HelloWorldServiceImpl.class 476B
HelloWorldService.class 171B
META-INF
.svn
tmp
props
props
entries 193B
xfire
.svn
tmp
props
props
entries 340B
text-base
services.xml.svn-base 410B
services.xml 730B
lib
xbean-2.2.0.jar 2.54MB
spring.jar 2.81MB
wsdl4j-1.6.2.jar 145KB
commons-codec-1.3.jar 46KB
commons-logging-1.1.1.jar 59KB
commons-httpclient-3.0.1.jar 273KB
xbean-spring-2.8.jar 175KB
xfire-all-1.2.6.jar 883KB
wss4j-1.5.2.jar 272KB
XmlSchema-1.4.5.jar 143KB
jdom-1.0.jar 150KB
web.xml 811B
index.jsp 829B
META-INF
MANIFEST.MF 39B
.myeclipse
.settings
org.eclipse.core.resources.prefs 88B
.classpath 1KB
共 32 条
- 1
资源评论
- wwwxxxkkk2012-10-15下载了没运行成功
- shenqi9982012-09-03我的程序为什么运行不了 把包换成我的也不行
sunjs技术客""
- 粉丝: 38
- 资源: 10
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功