Spring jaxws 整合

1,准备jar包:



jaxws-spring 1.8.jar
xbean-spring-2.8.jar 
jaxen-1.1.1 jar   ----操作dom

2, 写服务端类

@WebService
@SOAPBinding(style = Style.DOCUMENT,use = Use.LITERAL)
public class Services {

 protected ISinervice sinervice;
    @Resource 
    private WebServiceContext wsc;
    private IAccService accountService;
    private IInService interfaceService;

 @Autowired
 protected HibernateBaseDao dao;
 
 @WebMethod
 public String add(int a,int b){

return a+b;

}

3web.xml 添加

  
    myservices
   
     com.sun.xml.ws.transport.http.servlet.WSSpringServlet
    

 
 

 
    myservices
    /myservices/*
 

4 applicationcontex.xml

添加Spring拦截器:

添加bean:


 
 

添加:

 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xmlns:context="http://www.springframework.org/schema/context"
 
 xmlns:core="http://jax-ws.dev.java.net/spring/core"
    xmlns:servlet="http://jax-ws.dev.java.net/spring/servlet"
   
 xsi:schemaLocation="http://www.springframework.org/schema/beans
  http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
  http://www.springframework.org/schema/context
  http://www.springframework.org/schema/context/spring-context-3.0.xsd
  
  http://jax-ws.dev.java.net/spring/core
        http://jax-ws.dev.java.net/spring/core.xsd
        http://jax-ws.dev.java.net/spring/servlet
        http://jax-ws.dev.java.net/spring/servlet.xsd">

Spring管理服务:

   
     
     
     
    

    
 
  
     
                 
                     
               
  
           
   
  

 

5:用wsgen工具,把服务类生成源文件和wsdl

6.在web工程中的src文件夹下添加:

.apt_generated文件夹,把第5步生成的源文件拷贝到此文件家下,并在工程中添加此文件夹

7.刷新工程

8 :binggou!
( 转载注明出处:http://blog.csdn.net/u013538740/article/details/22882883)



你可能感兴趣的:(Spring jaxws 整合)