码迷,mamicode.com
首页 > 编程语言 > 详细

spring与CXF整合配置(服务端)

时间:2015-01-31 12:55:52      阅读:236      评论:0      收藏:0      [点我收藏+]

标签:cxf整合spring服务端

web.xml

<context-param>
       <param-name>contextConfigLocation</param-name>
       <param-value>classpath:applicationContext.xml</param-value>
    </context-param>
    <listener>
       <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
    </listener>


    <servlet>
       <servlet-name>CXF</servlet-name>
       <servlet-class>org.apache.cxf.transport.servlet.CXFServlet</servlet-class> //用于处理CXF请求
    </servlet>
   <servlet-mapping>
      <servlet-name>CXF</servlet-name>
      <url-pattern>/CXF/*</url-pattern>
   </servlet-mapping>


applicationContext.xml

  <?xml version="1.0" encoding="UTF-8"?>
<beans
xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:jaxws="http://cxf.apache.org/jaxws
xmlns:p="http://www.springframework.org/schema/p"
xsi:schemaLocation="http://www.springframework.org/schema/beans 
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://cxf.apache.org/jaxws  
    http://cxf.apache.org/schemas/jaxws.xsd
">


   <import resource="classpath:META-INF/cxf/cxf.xml"/>  
    <import resource="classpath:META-INF/cxf/cxf-extension-soap.xml"/>  
    <import resource="classpath:META-INF/cxf/cxf-servlet.xml"/> 
   

//发布服务配置
    <jaxws:endpoint implementor="impl.HelloWorldImpl" //暴露接口的实现类
         address="/Hello" >//表示入口
       <jaxws:inInterceptors>
          <bean class="util.AuthInInterceptor"/>//自定义的CXF拦截器
    </jaxws:inInterceptors>  


通过:http://localhost:8080//CXF_Spring/CXF/Hello?wsdl   就可以访问到wsdl文件

spring与CXF整合配置(服务端)

标签:cxf整合spring服务端

原文地址:http://blog.csdn.net/u013516966/article/details/43321707

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!