mvn 结构下spring+axis2开发webservice服务器端、客户端

最近接触一个项目需要用到mvn结构中搭建处理axis2的webservice服务。

搭建完成的目录如下:

mvn 结构下spring+axis2开发webservice服务器端、客户端_第1张图片

 

其中web.xml中的配置如下:

 

<!DOCTYPE web-app PUBLIC
 "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
 "http://java.sun.com/dtd/web-app_2_3.dtd" >

<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"   
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"   
 xsi:schemaLocation="http://java.sun.com/xml/ns/javaee   
   http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">

	<!-- 添加spring监听器 -->
	<listener>
		<listener-class>
			org.springframework.web.context.ContextLoaderListener
		</listener-class>
	</listener>
	<display-name>Archetype Created Web Application</display-name>
	<context-param>
		<param-name>contextConfigLocation</param-name>
		<param-value>classpath:applicationContext.xml</param-value>
	</context-param>
	<servlet>
		<servlet-name>AxisServlet</servlet-name>

		<servlet-class>

			org.apache.axis2.transport.http.AxisServlet

		</servlet-class>

		<load-on-startup>1</load-on-startup>

	</servlet>

	<servlet-mapping>

		<servlet-name>AxisServlet</servlet-name>

		<url-pattern>/services/*</url-pattern>

	</servlet-mapping>
</web-app>


 

其中org.springframework.web.context.ContextLoaderListener 配置spring的监听器

<servlet-name>AxisServlet</servlet-name><servlet-class>org.apache.axis2.transport.http.AxisServlet</servlet-class><load-on-startup>1</load-on-startup></servlet>

配置的是axis的webservice提供类

在WEB-INF下新建services目录

mvn 结构下spring+axis2开发webservice服务器端、客户端_第2张图片

 

services.xml的配置

<?xml version="1.0" encoding="UTF-8"?>
<serviceGroup>

	<service name="SyncService">

		<description>Test WebService</description>

		<parameter name="ServiceClass">

			com.moretrust.mtbp.webservice.MtbpSynWebService

		</parameter>
		<parameter name="ServiceObjectSupplier">

			org.apache.axis2.extensions.spring.receivers.SpringServletContextObjectSupplier

		</parameter>

		<parameter name="SpringBeanName">mtbpSynWebService</parameter>

		<messageReceivers>
                
                <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-out" 
                class="org.apache.axis2.rpc.receivers.RPCMessageReceiver"/>

		</messageReceivers>

	</service>

</serviceGroup>


spring的配置文件

<?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"
	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-3.0.xsd
           http://www.springframework.org/schema/aop 
           http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
           http://www.springframework.org/schema/tx
     	   http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
           http://www.springframework.org/schema/context
           http://www.springframework.org/schema/context/spring-context-3.0.xsd">
    <!-- 统一webservice入口 -->     
	<bean id="mtbpSynWebService" class="com.moretrust.mtbp.webservice.MtbpSynWebServiceImpl"/>
</beans>


具体jar包见以下链接

http://download.csdn.net/detail/liuzhigang1237/4504904

你可能感兴趣的:(spring,webservice,服务器,application,Class,encoding)