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);
}
}
jingxiao64
- 粉丝: 8
- 资源: 27
最新资源
- 基于mosquitto的android mqtt客户端详细文档+全部资料.zip
- 基于mqtt的消息推送系统,单点推送,分组推送详细文档+全部资料.zip
- 基于MQTT的聊天系统演示详细文档+全部资料.zip
- 基于mqtt的遥控器,在app上点击按钮,将码(空调码,电视码,风扇码)发送到mqqt,mqtt通过WiFi发给esp8266,esp8266解析转为红外,发出
- 基于Mqtt实现的简单推送服务的服务端详细文档+全部资料.zip
- 基于mqtt实现的即时通讯IM服务详细文档+全部资料.zip
- 基于mqtt开发sdk源码详细文档+全部资料.zip
- 基于MQTT实现的局域网通讯,模仿微信详细文档+全部资料.zip
- 最简单优雅的SQL操作类库
- 基于MQTT物联网用户终端程序详细文档+全部资料.zip
- 基于MQTT协议,物联网云平台的智慧路灯管理系统,在PC机上进行项目软件的Web开发,采集端的数据采用MQTT.fx进行模拟,数据通过MQTT协议进行传输到服务
- 基于MQTT协议的一个即时通讯安卓APP详细文档+全部资料.zip
- 基于MQTT协议的底层通讯SDK详细文档+全部资料.zip
- 基于MQTT协议的物联网健康监测系统详细文档+全部资料.zip
- 基于netty, spring boot, redis等开源项目实现的物联网框架, 支持tcp, udp底层协议和http, mqtt, modbus等上层协议
- 基于MQTT协议实现消息的即时推送Android开发详细文档+全部资料.zip
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈