1. server side:
(1) To demonstrate there's no issue with transferring objects, create a TestObj first:
package ws;
public class TestObj {
private String name;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
(2) Create service interface and implementation class
package ws;
public interface TestService {
TestObj sayHello(TestObj obj);
}
package ws;
public class TestServiceImpl implements TestService {
public TestObj sayHello(TestObj obj) {
obj.setName("hello" + obj.getName());
return obj;
}
}
(3) define a spring.xml under the WEB-INF folder
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
<bean id="testBean" class="ws.TestServiceImpl"/>
</beans>
(4) define xfire-servlet.xml under the WEB-INF folder
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
<bean
class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
<property name="urlMap">
<map>
<entry key="/TestService">
<ref bean="test" />
</entry>
</map>
</property>
</bean>
<bean id="test"
class="org.codehaus.xfire.spring.remoting.XFireExporter">
<property name="serviceFactory">
<ref bean="xfire.serviceFactory" />
</property>
<property name="xfire">
<ref bean="xfire" />
</property>
<property name="serviceBean">
<ref bean="testBean" />
</property>
<property name="serviceClass">
<value>ws.TestService</value>
</property>
</bean>
</beans>
(5) define web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.4"
xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
/WEB-INF/spring.xml
classpath:/org/codehaus/xfire/spring/xfire.xml
</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<servlet>
<servlet-name>xfire</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>xfire</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>
</web-app>
(6) here's a list of libraries used
activation-1.1.jar
commons-codec-1.3.jar
commons-httpclient-3.0.jar
commons-logging-1.0.4.jar
jdom-1.0.jar
spring-1.2.6.jar
stax-api-1.0.1.jar
wsdl4j-1.6.1.jar
wstx-asl-3.2.0.jar
xbean-spring-2.8.jar
xfire-all-1.2.6.jar
2. client side
(1) Normal client:
package client;
import java.net.MalformedURLException;
import org.codehaus.xfire.client.XFireProxyFactory;
import org.codehaus.xfire.service.Service;
import org.codehaus.xfire.service.binding.ObjectServiceFactory;
import ws.TestObj;
import ws.TestService;
public class NormalClient {
public static void main(String[] args){
String serviceURL="http://localhost:8080/XFire_Server/TestService";
Service serviceModel = new ObjectServiceFactory().create(TestService.class,null,serviceURL,null);
XFireProxyFactory serviceFactory = new XFireProxyFactory();
TestService service = null;
try {
service = (TestService) serviceFactory.create(serviceModel, serviceURL);
TestObj obj = new TestObj();
obj.setName("example");
System.out.println(service.sayHello(obj).getName());
} catch (MalformedURLException e) {
e.printStackTrace();
}
}
}
(2) Spring Client:
i. define spring.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
<bean id="testWebService" class="org.codehaus.xfire.spring.remoting.XFireClientFactoryBean">
<property name="serviceClass">
<value>ws.TestService</value>
</property>
<property name="wsdlDocumentUrl">
<value>http://localhost:8080/XFire_Server/TestService?WSDL</value>
</property>
</bean>
</beans>
ii. how to revoke:
package client;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import ws.TestObj;
import ws.TestService;
public class SpringClient {
public static void main(String[] args){
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(new String[] {"client/spring.xml"});
TestService client = (TestService)context.getBean("testWebService");
TestObj obj = new TestObj();
obj.setName("example");
System.out.println(client.sayHello(obj).getName());
}
}
(3) list of libraries used:
activation-1.1.jar
commons-codec-1.3.jar
commons-httpclient-3.0.jar
commons-logging-1.0.4.jar
jdom-1.0.jar
spring-1.2.6.jar
stax-api-1.0.1.jar
wsdl4j-1.6.1.jar
wstx-asl-3.2.0.jar
xfire-all-1.2.6.jar
XmlSchema-1.1.jar
分享到:
相关推荐
《xfire1.2.6_plugin:Eclipse插件详解》 在软件开发领域,Eclipse作为一款强大的集成开发环境(IDE),深受广大开发者喜爱。为了提升开发效率和功能拓展,Eclipse支持丰富的插件机制。其中,"xfire1.2.6_plugin"是...
8. **依赖管理**: 提供的`xfire1.2.6_all`压缩包可能包含了所有必要的依赖文件,这方便开发者快速集成到项目中,避免了手动解决依赖问题的麻烦。 9. **文档和社区支持**: 虽然XFire 1.2.6相对较旧,但在其活跃时期...
xfire1.2.6是早年间一个流行的开源SOAP服务框架,它允许开发者构建和消费Web服务。WS-Security(Web Services Security)是基于SOAP消息的安全标准,用于保护Web服务免受各种攻击,如篡改、伪造等。在这个示例中,...
Xfire1.2.6版API手册.chmXfire1.2.6版API手册.chmXfire1.2.6版API手册.chmXfire1.2.6版API手册.chm
XFire1.2.6完整版JAR包是一款历史悠久的游戏服务器通信软件,它主要用于网络游戏的多人联机功能。XFire的出现,使得玩家能够轻松地与朋友们一起进行在线游戏,享受更加流畅、稳定的多人对战体验。这个版本是1.2.6,...
现在我们来深入探讨Spring 2.0与XFire 1.2.6的整合案例。 Spring 2.0是Spring框架的一个重要版本,引入了许多增强的功能,例如支持JSR-250注解、更强大的数据访问抽象以及对AspectJ的全面集成。这些改进使得Spring...
在本压缩包“XFire1.2.6”中,包含的是XFire 1.2.6版本所需的全部jar文件,这些文件是开发者进行基于webservice开发的重要组成部分。 一、XFire简介 XFire是一个轻量级的Web服务实现,它通过简化API和快速的性能,...
《XFire 1.2.6:游戏服务器通信框架详解》 XFire,全称XFire Game Server Communication,是一款开源的游戏服务器通信框架,主要用于游戏服务器之间的实时通信和数据交换。在1.2.6版本中,它提供了稳定、高效的服务...
去除xfire传递date类型的数据时值为null时的异常的jar包
本篇将详细讲解如何利用Spring 3.0与Xfire 1.2.6进行集成,以开发高效的Web服务。 首先,让我们了解Spring 3.0。Spring 3.0是Spring框架的一个重大更新,引入了许多新特性和改进,如支持JSR-303 Bean Validation,...
xfire1.2.6 源代码 源文件 源程序。供调试、研究用。
XFire 1.2.6 调用 Web Service 的几种方法 XFire 1.2.6 是一个流行的开源 Web 服务框架,提供了多种调用 Web 服务的方法。了解这些方法对于开发高效、可靠的 Web 服务客户端非常重要。本文将详细介绍 XFire 1.2.6 ...
《Xfire 1.2.6 API:游戏通信与社区平台的开发利器》 Xfire是一款专注于游戏社区和即时通讯的软件,它为玩家提供了一个集游戏内聊天、好友列表、游戏状态追踪等功能于一体的平台。Xfire 1.2.6 API是开发者用于构建...
本项目"xfire1.2.6+spring2.5整合"是将XFire 1.2.6与Spring 2.5这两个开源框架进行融合,以实现更高效的服务导向架构。下面将详细解释这两个框架以及它们整合的意义和方法。 XFire是一个基于Java的Web服务框架,它...
**XFire 1.2.6 - 所有资源与Web服务实例详解** XFire是一个开源的Java Web服务实现框架,它提供了强大的功能,用于构建和消费基于SOAP(Simple Object Access Protocol)的服务。XFire 1.2.6是这个框架的一个版本,...
标题 "spring2.5+xfire1.2.6 客户端和服务端的配置" 涉及的是一个早期的Web服务集成方案,其中Spring 2.5是一个流行的Java应用框架,而Xfire 1.2.6则是一个用于构建和消费Web服务的库。在那个时代,Xfire是Spring...
《Xfire全方位解析:1.2.6版本的全面探讨》 Xfire,这款曾经在游戏社区中广受欢迎的即时通讯软件,以其独特的游戏整合功能和社交特性,为玩家提供了便捷的游戏内通信和社区交流平台。本文将深入探讨Xfire 1.2.6这一...
《xfire 1.2.6 server与cxf 1.2.6 client:构建高效服务交互》 在IT行业中,服务化已经成为企业系统架构的重要组成部分。xfire和CXF是两个广泛使用的Java Web服务框架,它们允许开发人员创建、发布和消费Web服务。...
xfire1.2.6是针对MyEclipse集成开发环境的一个插件,它主要用于支持XML Web服务的开发和部署。这个插件的核心功能是帮助开发者在MyEclipse中轻松地创建、测试和发布基于SOAP(Simple Object Access Protocol)的Web...
《Spring2.5+Hibernate3.0+Xfire1.2.6集成实践详解》 在软件开发领域,Spring、Hibernate和Xfire是三个至关重要的框架,它们分别在不同的层面上为开发者提供了强大的支持。本实例代码集合了Spring 2.5、Hibernate ...