那人之备:axis 与 spring 简单集成

来源:百度文库 编辑:九乡新闻网 时间:2024/04/27 16:58:48
web.xml
===========================================



contextConfigLocation
/WEB-INF/config/spring-config.xml


   
       org.springframework.web.context.ContextLoaderListener
   



        Set Character Encoding
       
            cn.sh.ideal.util.SetCharacterEncodingFilter
       

       
            encoding
            GBK
       



        Set Character Encoding
        /*


    action
    org.apache.struts.action.ActionServlet
   
      config
      /WEB-INF/config/struts-config.xml
   

   
      debug
      3
   

   
      detail
      3
   

    0


    AxisServlet
   
        org.apache.axis.transport.http.AxisServlet
   



    AdminServlet
    
        org.apache.axis.transport.http.AdminServlet
   

    100


    SOAPMonitorService
    
        org.apache.axis.monitor.SOAPMonitorService
   

   
      SOAPMonitorPort
      5001
   

    100


    AxisServlet
    /servlet/AxisServlet



    AxisServlet
    *.jws



    AxisServlet
    /services/*



    SOAPMonitorService
    /SOAPMonitor



    action
    *.do


    login_hwy.jsp


    wsdl
     text/xml


    xsd
    text/xml

   Apache-Axis
   
        org.apache.axis.transport.http.AxisHTTPSessionListener
   



server-config.wsdd   (axis对外接口的配置文件)
===========================================














  
   
  

  
   
   
  










http://xml.apache.org/axis/wsdd/








  
  










  





spring.xml   加入接口的实现类
===========================================
   
       
           
       

   



在接口类中要获取spring中管理的DAO 需要集成ServletEndpointSupport 类

如下 :
==========================
/**
* Mar 6, 2009
* 4:55:25 PM
* @author HeLiuhua
*
*/
public class OrderInfoServiceImpl extends ServletEndpointSupport implements OrderInfoService {

    private final Logger log = Logger.getLogger(this.getClass());
    private OrderDao orderDao;

    public String OrderHandle(String orderHandleInfo, String key) {
        // TODO Auto-generated method stub

        log.info("集团调用OrderHandle接口,密钥为:" + key + "; xml字符串为:"
                        + orderHandleInfo);

        OrderBean orderBean = new OrderBean();
        OrderModel orderModel = orderBean.getOrderHandel(orderHandleInfo);
   
      //注意dao的获取方式!!
        orderDao = (OrderDao) getWebApplicationContext().getBean("orderDao");
        ........................
.........................

        //status =1 不成功, =0 成功
        if (result) {
            retFlag = "" + unityId
                    + "
0";
        } else {
            retFlag = "" + unityId
                    + "
1";
        }
       
        return retFlag;
    }