首先添加相应jar包到web-inf的lib里面。
一、在web.xml添加下面代码
<servlet>
<display-name>Apache-Axis Servlet</display-name>
<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-INF
| web.xml
| services
| BookService
| META-INF
| services.xml
services.xml代码如下
<?xml version="1.0" encoding="UTF-8"?>
<serviceGroup>
<service name="UserService">
<description>Hello World Spring Service</description>
<!-- ServiceObjectSupplier为装载spring bean的类,必须有-->
<parameter name="ServiceObjectSupplier">
org.apache.axis2.extensions.spring.receivers.SpringServletContextObjectSupplier
</parameter>
<parameter
name="SpringBeanName">userServer</parameter> <!--
SpringBeanName不可变,userServer为spring中对应的bean-->
<operation name="axisTest">
<messageReceiver class="org.apache.axis2.rpc.receivers.RPCMessageReceiver" />
</operation>
</service>
</serviceGroup>
可通过 http://yourhost:port/应用名/services/UserService?wsdl访问。