Spring集成AXIS2的Web service配置方法
/WEB-INF/services/module-name/META-INF/services.xml(module-name可任意,目录结构需维持成这样)
/WEB-INF/services/module-name/META-INF/services.xml(module-name可任意,目录结构需维持成这样)
<serviceGroup>
<service name="service-name">
<parameter name="ServiceObjectSupplier">org.apache.axis2.extensions.spring.receivers.SpringServletContextObjectSupplier</parameter>
<parameter name="SpringBeanName">apiExampleService</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>
<messageReceiver class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver"/> <!--multiple action-->
</service>
</serviceGroup>
<service name="service-name">
<parameter name="ServiceObjectSupplier">org.apache.axis2.extensions.spring.receivers.SpringServletContextObjectSupplier</parameter>
<parameter name="SpringBeanName">apiExampleService</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>
<messageReceiver class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver"/> <!--multiple action-->
</service>
</serviceGroup>
web.xml:
<servlet>
<servlet-name>action</servlet-name><!--common web action-->
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<load-on-startup>2</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>action</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>AxisServlet</servlet-name>
<display-name>Apache-Axis Servlet</display-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><!--have to named as /services/-->
</servlet-mapping>
<servlet-name>AxisServlet</servlet-name>
<display-name>Apache-Axis Servlet</display-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><!--have to named as /services/-->
</servlet-mapping>
WSDL可以从http://server-ip-name:port/application-name/services/services-name?wsdl看出。这由Spring和AXIS后台实现,service的每个方法的参数都应该是action名下的直接子元素。可以用复合子元素来表示对象(必须是POJO标准的)。
本文转自 dannyy1026 51CTO博客,原文链接:
http://blog.51cto.com/dannyyuan/160504