axis2 webservice實現

1.官方下載地址:http://axis.apache.org/axis2/java/core/download.htmlhtml

官方文檔:http://ws.apache.org/axis2/1_0/userguide.htmljava

axis2 文檔翻譯:http://blog.csdn.net/tuwen/article/details/1816239web

axis2-1.7.4-bin.zip裏有axis2的jar包。 axis2-1.7.4-src.zip裏是源代碼。 axis2-1.7.4-war.zip裏是axis的管理平臺,放到tomcat可直接使用。spring

3.兩種方法:apache

(1)解壓 axis2-1.7.4-bin.zip將axis2下面的conf、repository下的modules和services複製到WEB-INF目錄tomcat

(2)將axis2-1.7.4-war.zip 解壓的axis2-1.7.4-war放入tomcat執行 生成文件路徑以下服務器

輸入圖片說明

將axis2-web(管理頁面) 文件夾放到項目WebRoot下和WEB-INF下的conf、modules和services複製到項目WEB-INF目錄app

conf下面只須要axis2.xml文件ide

3.最後在services下面新建一個文件夾,文件名隨意,再在下面新建META-INF目錄,裏面存放本身的services.xml,裏面配置本身的服務信息測試

<?xml version="1.0" encoding="UTF-8"?>
<serviceGroup>    
       <!-- name屬性配置WebService的名稱 -->  
   <service name="OpenService">
   <description>OpenService</description>    
     <parameter name="ServiceObjectSupplier">  
        org.apache.axis2.extensions.spring.receivers.SpringServletContextObjectSupplier  
    </parameter>    
   <!-- name固定= SpringBeanName-->  
 <!-- ServiceClass爲spring容器內管理的webservice接口類名稱-->  
     <parameter name="SpringBeanName">ServiceClass</parameter> 
    
    <!-- ServiceClass屬性配置提供WebService服務類的全類名 -->  
<!--      <parameter name="ServiceClass">com.webservice.WlyOpenServiceImpl</parameter>  -->
    <!--false 默認訪問address location 爲服務器ip地址   -->
<!-- <parameter name="modifyUserWSDLPortAddress">false</parameter>     -->
<!-- 下面兩個operation是webservice類中的接口 經過測試去掉也能夠   -->
    <operation name="SaveExamImages">
        <messageReceiver class="org.apache.axis2.rpc.receivers.RPCMessageReceiver" />
    </operation>
     <operation name="CustomerCheckItem"> 
         <messageReceiver class="org.apache.axis2.rpc.receivers.RPCMessageReceiver" /> 
    </operation> 
    <messageReceivers>    
           <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-out" class="org.apache.axis2.rpc.receivers.RPCMessageReceiver" />    
           <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-only" class="org.apache.axis2.rpc.receivers.RPCInOnlyMessageReceiver" />    
    </messageReceivers>    
  </service>    
</serviceGroup>

4.web.xml

<!-- 加入axis2支持 -->  
  <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>

axis的管理平臺:http://localhost:8080/services/listServices 輸入圖片說明 wsdl接口 地址:http://localhost:8080/services/OpenService?wsdl

相關文章
相關標籤/搜索