资源简介
Web Service示例。不知道如何写WEB service程序,那就认真看看这个实例吧!
代码片段和文件信息
package com.accp.client;
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 BookServiceClient {
private static XFireProxyFactory proxyFactory = new XFireProxyFactory();
private HashMap endpoints = new HashMap();
private Service service0;
public BookServiceClient() {
create0();
Endpoint BookServicePortTypeLocalEndpointEP = service0 .addEndpoint(new QName(“http://xfire.accp.com“ “BookServicePortTypeLocalEndpoint“) new QName(“http://xfire.accp.com“ “BookServicePortTypeLocalBinding“) “xfire.local://BookService“);
endpoints.put(new QName(“http://xfire.accp.com“ “BookServicePortTypeLocalEndpoint“) BookServicePortTypeLocalEndpointEP);
Endpoint BookServiceHttpPortEP = service0 .addEndpoint(new QName(“http://xfire.accp.com“ “BookServiceHttpPort“) new QName(“http://xfire.accp.com“ “BookServiceHttpBinding“) “http://localhost:8080/xfire-server/services/BookService“);
endpoints.put(new QName(“http://xfire.accp.com“ “BookServiceHttpPort“) BookServiceHttpPortEP);
}
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.accp.client.BookServicePortType.class) props);
{
AbstractSoapBinding soapBinding = asf.createSoap11Binding(service0 new QName(“http://xfire.accp.com“ “BookServicePort
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 645 2008-12-03 18:20 xfire-client\.classpath
文件 309 2008-12-03 18:11 xfire-client\.myme
文件 1014 2008-12-03 18:11 xfire-client\.project
文件 4610 2008-12-03 18:20 xfire-client\src\com\accp\client\BookServiceClient.java
文件 878 2008-12-03 18:20 xfire-client\src\com\accp\client\BookServicePortType.java
文件 1467 2008-12-03 18:28 xfire-client\src\com\accp\test\BookTest.java
文件 1464 2008-12-03 18:20 xfire-client\src\com\accp\xfire\AddBook.java
文件 1229 2008-12-03 18:20 xfire-client\src\com\accp\xfire\AddBookResponse.java
文件 1869 2008-12-03 18:20 xfire-client\src\com\accp\xfire\ArrayOfBook.java
文件 4872 2008-12-03 18:20 xfire-client\src\com\accp\xfire\Book.java
文件 748 2008-12-03 18:20 xfire-client\src\com\accp\xfire\GetAllBook.java
文件 1528 2008-12-03 18:20 xfire-client\src\com\accp\xfire\GetAllBookResponse.java
文件 3906 2008-12-03 18:20 xfire-client\src\com\accp\xfire\ob
文件 168 2008-12-03 18:20 xfire-client\src\com\accp\xfire\package-info.java
文件 39 2008-12-03 18:11 xfire-client\WebRoot\me
文件 5422 2008-12-03 18:20 xfire-client\WebRoot\WEB-INF\classes\com\accp\client\BookServiceClient.class
文件 796 2008-12-03 18:20 xfire-client\WebRoot\WEB-INF\classes\com\accp\client\BookServicePortType.class
文件 3032 2008-12-03 18:28 xfire-client\WebRoot\WEB-INF\classes\com\accp\test\BookTest.class
文件 916 2008-12-03 18:20 xfire-client\WebRoot\WEB-INF\classes\com\accp\xfire\AddBook.class
文件 797 2008-12-03 18:20 xfire-client\WebRoot\WEB-INF\classes\com\accp\xfire\AddBookResponse.class
文件 962 2008-12-03 18:20 xfire-client\WebRoot\WEB-INF\classes\com\accp\xfire\ArrayOfBook.class
文件 2171 2008-12-03 18:20 xfire-client\WebRoot\WEB-INF\classes\com\accp\xfire\Book.class
文件 562 2008-12-03 18:20 xfire-client\WebRoot\WEB-INF\classes\com\accp\xfire\GetAllBook.class
文件 981 2008-12-03 18:20 xfire-client\WebRoot\WEB-INF\classes\com\accp\xfire\GetAllBookResponse.class
文件 2713 2008-12-03 18:20 xfire-client\WebRoot\WEB-INF\classes\com\accp\xfire\ob
文件 321 2008-12-03 18:20 xfire-client\WebRoot\WEB-INF\classes\com\accp\xfire\package-info.class
文件 288 2008-12-03 18:11 xfire-client\WebRoot\WEB-INF\web.xm
文件 439 2008-12-03 16:56 xfire-server\.classpath
文件 309 2008-12-03 16:56 xfire-server\.myme
文件 1416 2008-12-03 17:20 xfire-server\.project
............此处省略50个文件信息
相关资源
- JAVAWEB_项目开发_网上订餐系统-CSDN
- 基于区块链的茶叶溯源平台源代码.
- how2j_offline_2020.01.31.zip
- javaweb使用mvc框架实现注册登录
- jsp_html_web_实现页面跳转
- 学习JAVA Web的过程和方法
- 《Java Web程序设计任务教程》_课后习
- Ajax实现java web 中下拉列表二级联动
- pagehelper-3.4.2-fixjar包完整版
- javaweb在线聊天网站
- Java Web中的入侵检测及简单实现
- java web开发资源库
- 通讯录web版
- 扫描仪web调用工具
- 基于JSP+Servlet+JavaBean+Dao开发模式——
- javaweb学生信息管理系统112595
- javaWEB面试题大全机会只有一次,千万
- 基于JavaWeb的服装销售管理系统的设计
- 一个纯jsp+Javabean+mysql的学生信息管理
- java web 购物车代码
- 基于WebSocket实现的Android和H5聊天通讯
- 基于javaweb 的bootstrap table 案例源码
- java web接收上传文件服务器端
- Java新闻发布系统源代码
- 自用webstorm配置setting jar包
- weblogic.9.2破解包
- 外文翻译--JSP及其WEB技术
- wqi-3.1.4-palmjoy-cn-0.8 胖鱼汉化版
- javaweb电商项目视频
- 基于javaweb的简单新闻管理系统
评论
共有 条评论