waterye

XFire Quick Start

XFire is a next-generation java SOAP framework. XFire makes service oriented development approachable through its easy to use API and support for standards. It is also highly performant since it is built on a low memory StAX based model.

Quick Start

1. download and unzip xfire-all-1.0-M6a.zip
2. cd examples/book
3. maven war
小插曲1: 安装Maven(第一次使用, 解压后将bin目录增加进PATH即可), maven 2.0不兼容1.x(没进一步了解), 某些jar下载不到时, 将jar放进maven Repository(估计有方法disable download的)
4. deploy xfire-demo.war to Tomcat

Access the WSDL via: http://localhost:8080/xfire-demo/services/BookService?wsdl


创建SOAP客户端
小插曲2: test case并没有client测试程序(XFire找不到相关Util Class), 对于Hello World程序, copy paste是首选方法, wuyu的接触xfire使用vs2005的J#, 自由的天空的web service 实践(1)使用C#, 似乎使用MS的技术创建SOAP客户端更简单, 刘冬的应用AXIS开始Web 服务之旅(Java的, 可以参考)
1. use WSDL2Java
Java -Djava.ext.dirs=lib org.apache.axis.wsdl.WSDL2Java http://localhost:8080/xfire-demo/services/BookService?wsdl

2. BookCilentTest.java

 1package org.codehaus.xfire;
 2
 3import org.codehaus.xfire.BookService.BookServiceLocator;
 4import org.codehaus.xfire.BookService.BookService;
 5import org.codehaus.xfire.BookService.BookServicePortType;
 6import org.codehaus.xfire.demo.Book;
 7
 8public class BookCilentTest {
 9 public static void main(String[] args) throws Exception{
10  BookService service = new BookServiceLocator();
11  BookServicePortType serviceType = service.getBookServiceHttpPort(); 
12  Book[] books = serviceType.getBooks();
13   
14  for (int i = 0; i < books.length; i ++)
15  {
16            Book book = (Book) books[i];
17            System.out.println("title:" + book.getTitle());
18            System.out.println("isbn:" + book.getIsbn());
19            System.out.println("author:" + book.getAuthor());
20            System.out.println("");
21        }

22 }

23}

posted on 2005-12-05 23:25 waterye 阅读(2225) 评论(7)  编辑  收藏 所属分类: Web Services

Feedback

# re: XFire Quick Start 2005-12-06 16:13 胡子鱼

以后有什么新的JAVA方面技术,到这里就行了:)  回复  更多评论   

# re: XFire Quick Start 2005-12-06 18:08 Water Ye

现在还是1.0-M6a, 连examples/spring都有bug, 在项目中使用请谨慎

<property name="service">
<ref bean="echoBean"/>
</property>
改为
<property name="serviceBean">
<ref bean="echoBean"/>
</property>

XFireExporter暂时不支持no interface的Service  回复  更多评论   

# re: XFire Quick Start 2005-12-08 18:29 Water Ye@ITO

XFire也有客户端测试: http://xfire.codehaus.org/Client+API
在spring+hibernate的测试环境中还有bug, 等待新版本

发现xfire完全copy spring的factory bean机制, 代码风格看上去好像同一Team写的  回复  更多评论   

# re: XFire Quick Start 2005-12-14 17:46 yapex

利用xfire Client API也能够很容易完成任务,参考http://xfire.codehaus.org/Client+API  回复  更多评论   

# re: XFire Quick Start 2006-02-28 10:40 Water Ye

XFire 1.0 Released

XFire 1.0 features include:
* Support for WSDL 1.1, SOAP 1.1 and 1.2, WS-Addressing, WS-I Basic Profile 1.1
* Pluggable bindings for POJOs, XMLBeans, JAXB 1.1, JAXB 2.0, and Castor support
* Support for many different transports - HTTP, JMS, XMPP, In-JVM, etc.
* Spring, Pico, Plexus, Loom, and Yan support
* Embeddable and Intuitive API
* Client and server stub generation
* JSR 181 2.0 API to configure services via Java 5 and 1.4 (Commons attributes JSR 181 syntax)
  回复  更多评论   

# re: XFire Quick Start 2006-09-14 13:35 hhe

撩撩完事,很是不经心啊,看来又是转贴  回复  更多评论   

# re: XFire Quick Start 2007-01-11 08:09 ju french

Hello everybody

Someone has succesfully work with Xfire??
I have problem with the example book :
javax.servlet.ServletException: Error initializing XFireServlet.

if you may help me, thank you very much

+  回复  更多评论   


只有注册用户登录后才能发表评论。


网站导航: