axis2结合spring发布
来源:互联网 发布:商家给淘宝什么发票 编辑:程序博客网 时间:2024/03/29 15:22
下载axis2axis2-1.6.2-war.zip把axis2.war放到tomcat的webapps目录下,启动tomcat,输入http://localhost:9080/axis2 出现后台页面即可。结合spring发布axis2一、HelloSpringpackage service;public class HelloSpring { public String sayHello(String name){ return "你好,"+name; } public String sayGoodMorning(String name){ return "早上好,"+name; }}
新建一个目录test,进入目录后,新建META-INF目录,然后在里面新建services.xml
内容如下
<?xml version="1.0" encoding="UTF-8"?><serviceGroup> <service name="helloSpring"> <description> Spring aware </description> <parameter name="ServiceObjectSupplier"> org.apache.axis2.extensions.spring.receivers.SpringServletContextObjectSupplier </parameter> <parameter name="SpringBeanName"> spring-hello </parameter> <messageReceivers> <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-out" class="org.apache.axis2.rpc.receivers.RPCMessageReceiver" /> </messageReceivers></service> </serviceGroup>
进入test目录,直接运行jar -cvf spring-hello.aar . (注意后面的点)
把生成的aar,复制到%Tomcat%/webapps/axis2/WEB-INF/services目录下。
把HelloSpring.class文件复制到%Tomcat%/webapps/axis2/WEB-INF/classes/service目录中
axis2项目的web.xml,增加
<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>
与web.xml同目录新建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:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd"> <bean id="spring-hello" class="service.HelloSpring"></bean></beans>
重启tomcat即可。输入http://localhost:9080/axis2 , 击services进入服务列表。
说明:例如spring打包不需要把.class文件打包。
1. 由JavaBean编译生成的.class文件需要放在WEB-INF\classes目录中,或打成.jar包后放在WEB-INF\lib目录中,而WEB-INF\services目录中的.aar包中不需要包含.class文件,而只需要包含一个META-INF目录,并在该目录中包含一个services.xml文件即可。
2. services.xml的配置方法与前几篇文章的配置方法类似,只是并不需要使用ServiceClass参数指定要发布成WebService的Java类,而是要指定在applicationContext.xml文件中的装配JavaBean的名称(SpringBeanName参数)。
3. 在services.xml文件中需要通过ServiceObjectSupplier参数指定SpringServletContextObjectSupplier类来获得Spring的ApplicationContext对象。
- axis2结合spring发布
- axis2结合spring发布
- axis2+spring 发布service
- axis2利用spring发布
- Axis2与Spring集成发布
- Axis2与Spring集成发布
- Axis2与Spring集成发布
- Axis2与spring结合创建webService
- WebService之Axis2系列教程Axis2与Spring集成发布
- axis2+spring集成发布webservice服务
- eclipse结合axis2发布webservice踩坑记录
- 结合spring mvc发布webservice
- Spring与CXF结合发布WebService
- AXIS2中将Spring装配的JavaBean发布为WebService
- AXIS2中将Spring装配的JavaBean发布为WebService
- webservice 笔记(小结) axis2 集成spring 发布服务
- spring集成axis2以接口方式发布webservice
- Axis2(7):将Spring的装配JavaBean发布成WebService
- ajax解析jso的三种方案
- 怎么让分页更高效
- google 地图 API 参考 .
- find your present
- Android--Telephony
- axis2结合spring发布
- myeclipse svn插件安装(link)
- Google Map API 应用实例说明 .
- 计算一篇文章中英文单词的个数
- LoadRunner_Linux 性能计数器详解_Average Load
- 天易10----js实现的类似百度地图(带查询功能)
- 逐渐新增N个Mnesia节点,并确保数据在这些节点上保持同步.
- hdu1754 i hate it 的错误代码
- java中this$0的含义及用法