Axis2+Spring

阅读更多

Axis2整合Spring

1、jar包

   1.1、axis2的jar包

 


		
			org.apache.axis2
			axis2
			1.6.2
		
		
		    org.apache.axis2
		    axis2-spring
		    1.6.2
		
		
			org.apache.axis2
			axis2-transport-http
			1.6.2
		
		
			org.apache.axis2
			axis2-transport-local
			1.6.2
		

 
   1.2、spring相关jar包

 

 


		
			org.springframework
			spring-core
			${spring.version}
		

		
			org.springframework
			spring-beans
			${spring.version}
		

		
			org.springframework
			spring-context
			${spring.version}
		

		
			org.springframework
			spring-tx
			${spring.version}
		

		
			org.springframework
			spring-web
			${spring.version}
		

		
			org.springframework
			spring-test
			${spring.version}
			test
		
		
		
	      org.springframework
	      spring-context-support
	      ${spring.version}
	    

 

 

2、创建服务端

   2.1、创建接口

 

package com.tzz.ws.axis.service;

public interface AxisHelloWorld {
	public String getMessage(String message);
}

   2.3、实现类

 

 

package com.tzz.ws.axis.service.impl;

import com.tzz.ws.axis.service.AxisHelloWorld;

public class AxisHelloWorldImpl implements AxisHelloWorld {

	@Override
	public String getMessage(String message) {
		return "---------Axis Server-------" + message;
	}
}

3、配置服务端

 

   3.1、服务端的spring配置文件applicationContext.xm

 

	
	

  3.2、配置services.xm

在/WEB-INF目录下建立目/services/axis/(这个名字可以随便取)
然后建立在其下META-INF目录,然后再在其目录下建立services.xml 

 



	
		org.apache.axis2.extensions.spring.receivers.SpringAppContextAwareObjectSupplier
	
	true
	axisHelloWorldService
	
		
		
	

   3.2、配置web.xm

 



	web-demo

	
	
		contextConfigLocation
		classpath:applicationContext.xml
	

	
	
		org.springframework.web.context.ContextLoaderListener
	

	  
        AxisServlet  
        org.apache.axis2.transport.http.AxisServlet  
        1  
      
          
      
        AxisServlet  
        /services/*  
      
	
    
		index.jsp
    

 4、测试:

浏览器输入:http://localhost:8080/web-demo/services/axisHelloWorld?wsdl

 

你可能感兴趣的:(axis2,spring,axis,wsdl)