微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

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>

 

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

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐