zoukankan      html  css  js  c++  java
  • 2.1.3版cxf配置webservice备忘

    以前用cxf配置webservice一直都很顺利,结合spring进行管理和注入都非常方便。近来公司需要在老框架上加入webservice,ssh的框架还是十年前的东西,新一点的cxf版本根本无法配置启动。无奈版本一直降低到了2.1.3才能正常使用。就是这么个低版本的配置让人栽了个大跟头。

    配置这块其实很简单。

    web.xml里要加载cxf的配置

    同样是web.xml里,要配置servlet,以及监听的路径。

    看看cxf的配置文件,真正的坑在这里。

    <?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.xsd
    http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd">
    <!-- webservice 接口服务定义 -->
    <import resource="classpath:META-INF/cxf/cxf.xml" />
    <import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
    <import resource="classpath:META-INF/cxf/cxf-extension-http.xml" />
    <import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />

    <!-- 3.X写法 -->
    <jaxws:endpoint address="/demoService" publish="true" implementor="com.demo.ws.DemoWebServiceImpl" />

      <!-- 2.X写法 -->
    <jaxws:endpoint id="reportDataService" address="/reportDataService"
    implementorClass="com.demo.ws.IReportDataWsService">
    <jaxws:implementor>
    <bean id="reportDataServiceImpl" class="com.demo.ws.ReportDataWsServiceImpl">
    </bean>
    </jaxws:implementor>
    </jaxws:endpoint>
    </beans>

    2.1.3版本里你要用3.X的写法,也能对外发布webservice,启动以及调用一点都不报错,但注入就完蛋了。始终是得到的null。换写法了就妥妥的。

    为了保持文章完整性,说明下java类的配置。


    以此几年我惨被谋杀的半个下午。
  • 相关阅读:
    ThinkPHP运算符 与 SQL运算符 对比表
    [Java 8] (6) Lambda与资源管理
    Codeforces Round #275 (Div. 2) C
    HOJ 2245 浮游三角胞(数学啊 )
    [UVALive 6663 Count the Regions] (dfs + 离散化)
    浅解ARC中的 __bridge、__bridge_retained和__bridge_transfer
    SpringMVC: web.xml中声明DispatcherServlet时一定要加入load-on-startup标签
    Unity3d 4.3.4f1执行项目
    更新Windows ActiveX,Ios
    C++11: final与override
  • 原文地址:https://www.cnblogs.com/musarona/p/6652990.html
Copyright © 2011-2022 走看看