资源简介
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个文件信息
相关资源
- 美食天下项目Android版源码和Web版源码
- java web网络通讯录
- commons-codec-1.3.jar和commons-httpclient-3.0
- java web学生管理系统(源码+数据库+截
- JavaWeb停车场管理系统(源代码,数据
- Java Web实现的易买网系统网站(源码
- 安装libwebkitgtk提示没有可用的软件包
- 基于JAVAweb的教务排课系统
- 锐聘学院QST青软JavaWeb十二个打包
- javaweb网上购物系统源码(附数据库脚
- javaweb校园宿舍系统(附数据库脚本)
- JavaWeb书城项目(附数据库脚本)
- websockets实现tomcat日志在线输出
- jsp讲解
- 基于SSH框架的JavaWeb项目—人员信息管
- javaweb实现的邮件收发系统(附数据库
- 一款Java的MySqlWeb管理工具
- websocket推送(兼容低版本的IE浏览器)
- java web知识点总结思维导图
- java web项目案例——知识管理软
- 博客系统笔记以及源码
- 李兴华JavaWeb培训经典笔记
- javaweb程序源码
- 网上商城后台管理系统Oracle+Java web
- java实现websocket简单demo
- StudentManagerWeb.zip
- [Java] Java Web 应用高级编程 (英文版)
- 基于JavaWeb的美食图片分享网站.zip
- webshell -真实可用的jsp 马
- JavaWeb-学生在线选课系统
评论
共有 条评论