Webservice CXF学习

1           下载CXF文件

apache官方网下载apache-cxf-2.2.2,地址:http://cxf.apache.org/

2           学习视频教程

2.1          视频

Iteye网站上的视频教程,可以下载学习使用

http://www.iteye.com/topic/305642

 

3           CXFSpring集成配置重点分析

3.1          application.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:aop="http://www.springframework.org/schema/aop"

    xmlns:tx="http://www.springframework.org/schema/tx"

    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://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd

       http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd

       http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd">

    <!—注意上面标签配置与常规spring的不同-->

    <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="helloWorld" mplementor="server.HelloWorldImpl"

       address="/helloWorld" />

</beans>

 

3.2          web.xml中的重要代码

<?xml version="1.0" encoding="UTF-8"?>

<web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee"

    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

    xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee

    http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">

    <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>/services/*</url-pattern>

    </servlet-mapping>

<!—注意上面标签配置加入了/services/*配置,如果项目中还用到过滤器,就要注意把它的路径也也忽略掉-->

</web-app>

 

其他资料网络上很多,就不再一一列举,我写的就是我的经验,为了在实际项目中配对,也走了一些弯路,希望分享给大家,能给大家一定的帮助。

 

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值