spring整合axis2(最小配置化)的示例
参考文档:
http://blog.csdn.net/xinhaoluan/article/details/3605234
环境配置:
实现步骤:
1.eclipse新建Dynamic Web Project,本例工程名为:ws-sample
2.将spring-framework和axis2的lib加入工程中
3.编写测试服务:
IHello.java(interface)
package com.lichmama.ws.demo.intf;
public interface IHello {
public String sayHello(String name);
}
HelloImpl.java(class)
package com.lichmama.ws.demo.service;
import org.springframework.stereotype.Service;
import com.lichmama.ws.demo.intf.IHello;
@Service("helloService")
public class HelloImpl implements IHello {
@Override
public String sayHello(String name) {
if((name == null) || (name == "")) {
name = "anonymous";
}
return "hello, " + name;
}
}
3.新建spring配置文件/WEB-INF/applicationContext.xml:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd"> <context:annotation-config />
<context:component-scan base-package="com.lichmama.ws.demo" /> <bean id="applicationContext"
class="org.apache.axis2.extensions.spring.receivers.ApplicationContextHolder" />
</beans>
4.新建/WEB-INF/services/axis2/META-INF/services.xml:
<?xml version="1.0" encoding="UTF-8" ?>
<serviceGroup>
<service name="HelloService" scope="application">
<description>simple spring example</description>
<parameter name="ServiceObjectSupplier">
org.apache.axis2.extensions.spring.receivers.SpringAppContextAwareObjectSupplier
</parameter>
<parameter name="SpringBeanName">helloService</parameter>
<messageReceivers>
<messageReceiver mep= "http://www.w3.org/2004/08/wsdl/in-only"
class = "org.apache.axis2.rpc.receivers.RPCInOnlyMessageReceiver" />
<messageReceiver mep= "http://www.w3.org/2004/08/wsdl/in-out"
class = "org.apache.axis2.rpc.receivers.RPCMessageReceiver" />
</messageReceivers>
</service>
</serviceGroup>
5.配置/WEB-INF/web.xml:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
id="WebApp_ID" version="3.0"> <display-name>ws-sample</display-name>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener
</listener-class>
</listener>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/applicationContext.xml</param-value>
</context-param> <servlet>
<servlet-name>AxisServlet</servlet-name>
<servlet-class>org.apache.axis2.transport.http.AxisServlet</servlet-class>
</servlet> <servlet-mapping>
<servlet-name>AxisServlet</servlet-name>
<url-pattern>/services/*</url-pattern>
</servlet-mapping> <welcome-file-list>
<welcome-file>index.jsp</welcome-file>
<welcome-file>index.html</welcome-file>
</welcome-file-list> </web-app>
6.完成以上工作后工程目录结构如下:

7.发布工程,启动tomcat
8.访问http://localhost:8080/ws-sample/services/HelloService?wsdl,查看服务是否发布成功。
如果发布成功的话,访问http://localhost:8080/ws-sample/services/HelloService/sayHello?name=lichmama结果应该如下:

9.*简易的做法是下载axis2-war.zip(http://archive.apache.org/dist/axis/axis2/java/core/1.6.2/axis2-1.6.2-war.zip),复制WEB-INF下的文件到工程对应目录。
然后再根据实际情况修改各配置文件(application.xml, services.xml, web.xml)。
10.*上述示例工程下载地址:http://pan.baidu.com/s/1hrBsZ4o
spring整合axis2(最小配置化)的示例的更多相关文章
- 初识quartz 并分析 项目中spring整合quartz的配置【原创+转载】
初识quartz 并分析 项目中spring整合quartz的配置[原创+转载]2018年01月29日 12:08:07 守望dfdfdf 阅读数:114 标签: quartz 更多个人分类: 工具 ...
- spring整合mybatis(hibernate)配置
一.Spring整合配置Mybatis spring整合mybatis可以不需要mybatis-config.xml配置文件,直接通过spring配置文件一步到位.一般需要具备如下几个基本配置. 1. ...
- spring 整合 hibernate xml配置
spring 整合 hibernate: hibernate :对数据库交互 spring: ioc aop 整合点: 1.sessionFactory对象不再由hibernate生成,交由spr ...
- Spring第十一篇——–Spring整合Hibernate之配置数据源
DataSource(数据源)提供了一个标准化的取得数据库连接的方式,通过getConnection()方法即可取得数据库的连接,Spring也提供了数据库连接池(DataBase connectio ...
- Spring整合Struts2的配置与测试
整合目的 让Spring的IOC容器管理Struts2的Action 整合步骤 1.新建一个Web项目 2.加入Spring的jar包和添加Spring的配置文件 3.在Web.xml中配置Conte ...
- spring 整合 struts2 xml配置
整合之前要搞清楚struts2是什么; struts2:表现层框架 增删改查 作用域 页面跳转 异常处理 ajax 上传下载 excel 调用service spring :IOC/ ...
- mybatis和spring整合的关键配置
spring配置文件 applicationContext.xml: <beans xmlns="http://www.springframework.org/schema/beans ...
- 阶段3 3.SpringMVC·_07.SSM整合案例_09.ssm整合之Spring整合MyBatis框架配置事务
spring加入声明式的事物 配置事物 配置事物管理器 需要一个dataSource,引入上面的dataSource 配置事务通知 引入上面的transactionManager事物管理器 find开 ...
- Spring 整合 Redis (零配置) 的简单使用
pom.xml <!--jedis--> <dependency> <groupId>redis.clients</groupId> <artif ...
随机推荐
- MyBatis起步
作用:封装了JDBC操作,简化数据库访问代码.封装的功能:1.获取连接,执行SQL,释放连接2.SQL参数设置(可以直接传入对象,Mybtis会将对象的属性传入SQL语句) #{属性值}取代JDBC的 ...
- CentOS7下配置网络yum源(附带下载地址)
一.查看外网是否通畅 配置网络yum源(需要保证外网开通,我这里是使用网易163提供开源镜像站) 二.下载repo文件 cd /etc/yum.repos.dwget http://mirrors.1 ...
- SmartCoder每日站立会议10
站立会议内容: 准备为上交第一阶段项目进行加班,将各个页面联系起来,静态地图变为动态转换,考虑地图全屏或者是小屏即消息展示方式 1.站立会议照片: 2.任务展板: 3.燃尽图:
- ThinkPHP5.0版本和ThinkPHP3.2版本的区别
5.0版本和之前版本的差异较大,本篇对熟悉3.2版本的用户给出了一些5.0的主要区别. URL和路由 5.0的URL访问不再支持普通URL模式,路由也不支持正则路由定义,而是全部改为规则路由配合变量规 ...
- 【小练习06】HTML+CSS--电影公告
要求实现如下效果图: 代码演示 <!DOCTYPE html> <html> <head> <meta charset="UTF-8"&g ...
- 简单vue项目脚手架(vue+webpack2.0+vuex+vue-router)
github地址 使用技术栈 webpack(^2.6.1) webpack-dev-server(^2.4.5) vue(^2.3.3) vuex(^2.3.1) vue-router(^2.5.3 ...
- Unity 打包总结和资源的优化和处理
1. Texture,都去掉alpha通道,作为背景展示的图片,基本都没有透明要求,有特殊要求的则放到atlas里面 a. Loading图这类需要比较精细的,则把图片设置为Automatic Tru ...
- Cookie的作用以及封装的方法
Cookie相当于本地储存(local Storage),也是一种储存信息的方式. 它通过 document.cookie ='name=value' //name name值 value value ...
- 实现Runnable接口和继承Thread类之间的区别
在Java语言中,我们都知道,有两种创建线程的方式,一中是使用Runnable接口,另一种是使用Thread类. public class DemoRunnable implements Runnab ...
- 使用JPA和Hibernate进行批量处理的最佳方式
Tips 原文作者:Vlad Mihalcea 原文地址:The best way to do batch processing with JPA and Hibernate 在本文中,你将了解什么是 ...