package com.wincpt.service;
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 orderClient {
private static XFireProxyFactory proxyFactory = new XFireProxyFactory();
private HashMap endpoints = new HashMap();
private Service service0;
public orderClient() {
create0();
Endpoint orderHttpPortEP = service0.addEndpoint(new QName(
"http://service.wincpt.com", "orderHttpPort"), new QName(
"http://service.wincpt.com", "orderHttpBinding"),
"http://192.168.1.43:8080/WsServer/services/order");
endpoints.put(new QName("http://service.wincpt.com", "orderHttpPort"),
orderHttpPortEP);
Endpoint orderPortTypeLocalEndpointEP = service0.addEndpoint(new QName(
"http://service.wincpt.com", "orderPortTypeLocalEndpoint"),
new QName("http://service.wincpt.com",
"orderPortTypeLocalBinding"), "xfire.local://order");
endpoints.put(new QName("http://service.wincpt.com",
"orderPortTypeLocalEndpoint"), orderPortTypeLocalEndpointEP);
}
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.wincpt.service.orderPortType.class), props);
{
AbstractSoapBinding soapBinding = asf.createSoap11Binding(service0,
new QName("http://service.wincpt.com", "orderHttpBinding"),
"http://schemas.xmlsoap.org/soap/http");
}
{
AbstractSoapBinding soapBinding = asf.createSoap11Binding(service0,
new QName("http://service.wincpt.com",
"orderPortTypeLocalBinding"),
"urn:xfire:transport:local");
}
}
public com.wincpt.service.orderPortType getorderHttpPort() {
return ((com.wincpt.service.orderPortType) (this)
.getEndpoint(new QName("http://service.wincpt.com",
"orderHttpPort")));
}
public com.wincpt.service.orderPortType getorderHttpPort(String url) {
com.wincpt.service.orderPortType var = getorderHttpPort();
org.codehaus.xfire.client.Client.getInstance(var).setUrl(url);
return var;
}
public com.wincpt.service.orderPortType getorderPortTypeLocalEndpoint() {
return ((com.wincpt.service.orderPortType) (this)
.getEndpoint(new QName("http://service.wincpt.com",
"orderPortTypeLocalEndpoint")));
}
public com.wincpt.service.orderPortType getorderPortTypeLocalEndpoint(
String url) {
com.wincpt.service.orderPortType var = getorderPortTypeLocalEndpoint();
org.codehaus.xfire.client.Client.getInstance(var).setUrl(url);
return var;
}
public static void main(String[] args) {
orderClient client = new orderClient();
//create a default service endpoint
com.wincpt.service.orderPortType orderPortType = client
.getorderHttpPort();
//TODO: Add custom client code here
//
//orderPortType.yourServiceOperationHere();
String result = orderPortType.procOrder("zhangsan", 100000);
System.out.println(result);
System.out.println("test client completed");
System.exit(0);
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
jsp最后一章例子.rar (62个子文件)
Client
.project 382B
bin
cn
sjx
services
IOrder.class 171B
test
OrderClient.class 2KB
com
wincpt
service
ObjectFactory.class 724B
ProcOrder.class 1KB
orderPortType.class 734B
orderClient.class 5KB
ProcOrderResponse.class 955B
package-info.class 329B
src
cn
sjx
services
IOrder.java 153B
test
OrderClient.java 994B
com
wincpt
service
orderClient.java 4KB
ObjectFactory.java 1KB
orderPortType.java 749B
ProcOrderResponse.java 1KB
package-info.java 176B
ProcOrder.java 2KB
.classpath 537B
WsServer
.project 1KB
.settings
com.genuitec.eclipse.ws.xfire.prefs 145B
.mymetadata 297B
WebRoot
WEB-INF
web.xml 621B
lib
classes
cn
sjx
services
IOrder.class 171B
OrderImpl.class 952B
META-INF
xfire
services.xml 363B
META-INF
MANIFEST.MF 39B
.myeclipse
src
cn
sjx
services
IOrder.java 147B
OrderImpl.java 315B
WebServices
services.xml 363B
.classpath 439B
WsOr
.project 380B
bin
cn
sjx
services
ObjectFactory.class 706B
ProcOrder.class 1KB
ProcOrderResponse.class 949B
package-info.class 323B
client
OrderClient.class 5KB
OrderPortType.class 726B
src
cn
sjx
services
ObjectFactory.java 1KB
ProcOrderResponse.java 1KB
package-info.java 170B
ProcOrder.java 2KB
client
OrderPortType.java 732B
OrderClient.java 4KB
.classpath 431B
ClientWeb
.project 385B
.classpath 226B
WsClient
.project 384B
.classpath 226B
WsClint_1
.project 385B
bin
com
wincpt
service
ObjectFactory.class 724B
ProcOrder.class 1KB
orderPortType.class 734B
orderClient.class 5KB
ProcOrderResponse.class 955B
package-info.class 329B
src
com
wincpt
service
orderClient.java 4KB
ObjectFactory.java 1KB
orderPortType.java 749B
ProcOrderResponse.java 1KB
package-info.java 176B
ProcOrder.java 2KB
.classpath 537B
共 62 条
- 1
资源评论
jingxiao64
- 粉丝: 8
- 资源: 27
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功