加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

Webservice CXF学习

发布时间:2020-12-17 01:19:02 所属栏目:安全 来源:网络整理
导读:1 ?????????? 下载 CXF 文件 apache 官方网下载 apache-cxf-2.2.2, 地址: http://cxf.apache.org/ 2 ?????????? 学习视频教程 2.1 ????????? 视频 Iteye 网站上的视频教程,可以下载学习使用 http://www.iteye.com/topic/305642 ? 3 ?????????? CXF 与 Spri

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>

?

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

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读