webservice 基于spring的cxf发布

来源:互联网 发布:淘宝网禁止发布 编辑:程序博客网 时间:2024/04/27 18:54

                                                                                                                      webservice 基于spring的cxf

我的程序:  http://pan.baidu.com/s/1qYCdz0w

    1.我写的是web工程

            首先从我的工程中copy架包

   2.在classpath目录配置一个bean.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"   xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsdhttp://cxf.apache.org/jaxws http://cxf.apache.org/jaxws">      <!-- 引cxf的一些核心配置 -->   <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      id="orderWS2"      implementor="cxf_spring.OrderWSImpl"      address="/orderws1">     <!-- <jaxws:inInterceptors>     <bean class="com.atguigu.day01_ws.interceptor.CheckUserInterceptor"></bean>     </jaxws:inInterceptors> -->    </jaxws:endpoint>     </beans>

3.配置web.xml文件 在web中加入:

  <!-- 配置beans.xml -->  <context-param>      <param-name>contextConfigLocation</param-name>      <param-value>classpath:beans.xml</param-value>   </context-param>      <!--    应用启动的一个监听器    -->   <listener>      <listener-class>         org.springframework.web.context.ContextLoaderListener      </listener-class>   </listener>      <!--    所有请求都会先经过cxf框架    -->   <servlet>      <servlet-name>CXFServlet</servlet-name>      <servlet-class>         org.apache.cxf.transport.servlet.CXFServlet      </servlet-class>      <load-on-startup>1</load-on-startup>   </servlet>   <servlet-mapping>      <servlet-name>CXFServlet</servlet-name>      <url-pattern>/*</url-pattern>    </servlet-mapping>

4.现在启动工程了;






0 0