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 ...
随机推荐
- 【JAVAWEB学习笔记】28_jqueryAjax:json数据结构、jquery的ajax操作和表单校验插件
Ajax-jqueryAjax 今天内容: 1.json数据结构(重点) 2.jquery的ajax操作(重点) 3.jquery的插件使用 一.json数据结构 1.什么是json JSON(J ...
- React源码学习——ReactClass
前言 之前一直在使用react做开发,但是对其内部的工作机制却一点儿都不了解,说白了就是一直在套api,毫无成就感.趁最近比较闲,对源码做了一番研究,并通过博客的方式做一些记录. 进入正题 通过编写自 ...
- mongo - 升级步骤
升级步骤1. 关闭balancer登陆mongos,执行sh.stopBalancer(),或者 连接到mongos>use config>db.settings.update( { _i ...
- Java文件流之练习
1 )将"今年是反法西斯胜利70周年,举国欢庆,所以要放假啦" 字符串 使用文件字符输出流 写入到oldhappy.txt文件中,复写10000行, 要求换行 在文件的开头写入当前 ...
- canvas——随机生成迷宫
先上图. 效果 代码 随机生成迷宫要求任意两点都能够找到相同的路径,也就是说,迷宫是一个连通图.随机生成迷宫可以使用普里姆算法.广度优先算法.深度优先算法等实现.这里将使用普里姆算法通过生成最小数的方 ...
- 做一枚精致的程序猿,Fighting!
这几天我和我们的团队正在做一个公司管理系统的项目,团队分工根据成员的水平高低来分工,这样看似公平,但其实不公平,如此这样一来,那些水平稍不如别人的成员就没有发展的机会?那么问题来了,对于水平稍逊色的程 ...
- CEF3 获取Cookie例子 CefCookieManager C++
首先从cef_cookie.h 源码种看到CefCookieManager 这个类: // Visit all cookies on the IO thread. The returned cooki ...
- BUGKUctf-web-writeup
---恢复内容开始--- 找到了个ctf平台.里面的web挺多的.终于将web题目写的差不多了. Web 签到题 加群就可以了 Web2 直接F12就看到了 文件上传测试 Burp抓包 文件名改成 1 ...
- GPUImage的filter 响应处理链 的理解笔记
GPUImage的filter的textures处理链式结构 两个最重要的的地方: 最重要的一个类GPUImageOutput(所有的filter的父类,其他也有继承它的,如GPUImageUIEle ...
- 常用数组、字符串方法总结&获取元素、DOM操作
字符串的方法.返回值.是否改变原字符串:1 charAt() 方法可返回指定位置的字符. 不改变原始字符串 JavaScript并没有一种有别于字符串类型的字符数据类型,返回的字符是长度为 1 的字符 ...