package com.xfire.test;
import java.net.MalformedURLException;
import java.util.Collection;
import java.util.HashMap;
import javax.xml.namespace.QName;
import org.codehaus.xfire.XFireRuntimeException;
import org.codehaus.xfire.aegis.AegisBindingProvider;
import org.codehaus.xfire.annotations.AnnotationServiceFactory;
import org.codehaus.xfire.annotations.jsr181.Jsr181WebAnnotations;
import org.codehaus.xfire.client.XFireProxyFactory;
import org.codehaus.xfire.jaxb2.JaxbTypeRegistry;
import org.codehaus.xfire.service.Endpoint;
import org.codehaus.xfire.service.Service;
import org.codehaus.xfire.soap.AbstractSoapBinding;
import org.codehaus.xfire.transport.TransportManager;
public class SayHelloServiceClient {
private static XFireProxyFactory proxyFactory = new XFireProxyFactory();
private HashMap endpoints = new HashMap();
private Service service0;
public SayHelloServiceClient() {
create0();
Endpoint SayHelloServicePortTypeLocalEndpointEP = service0 .addEndpoint(new QName("http://xfire.codehaus.org/SayHelloService", "SayHelloServicePortTypeLocalEndpoint"), new QName("http://xfire.codehaus.org/SayHelloService", "SayHelloServicePortTypeLocalBinding"), "xfire.local://SayHelloService");
endpoints.put(new QName("http://xfire.codehaus.org/SayHelloService", "SayHelloServicePortTypeLocalEndpoint"), SayHelloServicePortTypeLocalEndpointEP);
Endpoint SayHelloServiceHttpPortEP = service0 .addEndpoint(new QName("http://xfire.codehaus.org/SayHelloService", "SayHelloServiceHttpPort"), new QName("http://xfire.codehaus.org/SayHelloService", "SayHelloServiceHttpBinding"), "http://localhost:8080/xfire/services/SayHelloService");
endpoints.put(new QName("http://xfire.codehaus.org/SayHelloService", "SayHelloServiceHttpPort"), SayHelloServiceHttpPortEP);
}
public Object getEndpoint(Endpoint endpoint) {
try {
return proxyFactory.create((endpoint).getBinding(), (endpoint).getUrl());
} catch (MalformedURLException e) {
throw new XFireRuntimeException("Invalid URL", e);
}
}
public Object getEndpoint(QName name) {
Endpoint endpoint = ((Endpoint) endpoints.get((name)));
if ((endpoint) == null) {
throw new IllegalStateException("No such endpoint!");
}
return getEndpoint((endpoint));
}
public Collection getEndpoints() {
return endpoints.values();
}
private void create0() {
TransportManager tm = (org.codehaus.xfire.XFireFactory.newInstance().getXFire().getTransportManager());
HashMap props = new HashMap();
props.put("annotations.allow.interface", true);
AnnotationServiceFactory asf = new AnnotationServiceFactory(new Jsr181WebAnnotations(), tm, new AegisBindingProvider(new JaxbTypeRegistry()));
asf.setBindingCreationEnabled(false);
service0 = asf.create((com.xfire.test.SayHelloServicePortType.class), props);
{
AbstractSoapBinding soapBinding = asf.createSoap11Binding(service0, new QName("http://xfire.codehaus.org/SayHelloService", "SayHelloServicePortTypeLocalBinding"), "urn:xfire:transport:local");
}
{
AbstractSoapBinding soapBinding = asf.createSoap11Binding(service0, new QName("http://xfire.codehaus.org/SayHelloService", "SayHelloServiceHttpBinding"), "http://schemas.xmlsoap.org/soap/http");
}
}
public SayHelloServicePortType getSayHelloServicePortTypeLocalEndpoint() {
return ((SayHelloServicePortType)(this).getEndpoint(new QName("http://xfire.codehaus.org/SayHelloService", "SayHelloServicePortTypeLocalEndpoint")));
}
public SayHelloServicePortType getSayHelloServicePortTypeLocalEndpoint(String url) {
SayHelloServicePortType var = getSayHelloServicePortTypeLocalEndpoint();
org.codehaus.xfire.client.Client.getInstance(var).setUrl(url);
return var;
}
public SayHelloServicePortType getSayHelloServiceHttpPort() {
return ((SayHelloServicePortType)(this).getEndpoint(new QName("http://xfire.codehaus.org/SayHelloService", "SayHelloServiceHttpPort")));
}
public SayHelloServicePortType getSayHelloServiceHttpPort(String url) {
SayHelloServicePortType var = getSayHelloServiceHttpPort();
org.codehaus.xfire.client.Client.getInstance(var).setUrl(url);
return var;
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
xfire-1.2.6所有资源--实例
共50个文件
java:12个
class:12个
xml:8个
5星 · 超过95%的资源 需积分: 9 29 下载量 157 浏览量
2011-05-07
23:18:15
上传
评论
收藏 19.42MB ZIP 举报
温馨提示
xfire-1.2.6所有资源--实例 xfire-1.2.6所有资源--实例 xfire-1.2.6所有资源--实例
资源推荐
资源详情
资源评论
收起资源包目录
xfire.zip (50个子文件)
XFireClient
.project 1KB
SayHelloService.wsdl 2KB
.settings
com.genuitec.eclipse.j2eedt.core.prefs 1KB
.mymetadata 307B
WebRoot
WEB-INF
web.xml 669B
lib
commons-httpclient-3.0.jar 273KB
classes
org
codehaus
xfire
sayhelloservice
ObjectFactory.class 814B
SayHelloResponse.class 983B
SayHello.class 951B
package-info.class 361B
META-INF
xfire
services.xml 360B
com
xfire
test
SayHelloServiceClient.class 5KB
Test.class 1KB
SayHelloServlet.class 2KB
SayHelloServiceImpl.class 796B
SayHelloServicePortType.class 752B
index.jsp 829B
META-INF
MANIFEST.MF 39B
.myeclipse
src
org
codehaus
xfire
sayhelloservice
SayHello.java 1KB
ObjectFactory.java 1KB
SayHelloResponse.java 1KB
package-info.java 208B
META-INF
xfire
services.xml 360B
com
xfire
test
SayHelloServiceImpl.java 419B
SayHelloServiceClient.java 4KB
SayHelloServlet.java 1KB
Test.java 395B
SayHelloServicePortType.java 741B
.classpath 526B
buuild1.xml 2KB
ant.bat 49B
build.xml 1KB
xfire-distribution-1.2.6.zip 18.07MB
XFire开发指南.pdf 1.12MB
XFireDemo
.project 1KB
.settings
com.genuitec.eclipse.j2eedt.core.prefs 1KB
com.genuitec.eclipse.core.prefs 149B
.mymetadata 297B
WebRoot
WEB-INF
web.xml 1KB
lib
classes
META-INF
xfire
services.xml 387B
com
control
SayHelloServlet.class 2KB
xfire
ISayHello.class 169B
SayHello.class 646B
index.jsp 829B
META-INF
MANIFEST.MF 39B
.myeclipse
src
META-INF
xfire
services.xml 387B
com
control
SayHelloServlet.java 2KB
xfire
SayHello.java 146B
ISayHello.java 89B
.classpath 526B
共 50 条
- 1
资源评论
- gym123452013-07-11项目中要用webservice技术,打算用xfire了,正好
mike_caoyong
- 粉丝: 76
- 资源: 151
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功