CXF spring 整合
来源:互联网 发布:java socket连接 编辑:程序博客网 时间:2024/06/05 19:53
1、准备jar包:
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">
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/classes/applicationContext-server.xml</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.util.IntrospectorCleanupListener</listener-class>
</listener>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<servlet>
<servlet-name>CXFService</servlet-name>
<servlet-class>org.apache.cxf.transport.servlet.CXFServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>CXFService</servlet-name>
<url-pattern>/service/*</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
</web-app>
3、cxf配置文件:applicationContext-server.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-2.5.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-2.5.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
http://cxf.apache.org/jaxws
http://cxf.apache.org/schemas/jaxws.xsd">
<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"/>
<bean id="DevNodeWebServiceImpl" class="com.dp.test.DevNodeWebServiceImpl"/>
<!-- 注意下面的address,这里的address的名称就是访问的WebService的name -->
<jaxws:server id="NodeWebService" serviceClass="com.test.service.NodeWebService" address="/NodeWebService">
<jaxws:serviceBean>
<!-- 要暴露的 bean 的引用 -->
<ref bean="DevNodeWebServiceImpl"/>
</jaxws:serviceBean>
</jaxws:server>
</beans>
4、接口类:NodeWebService
package com.test.service;
import javax.jws.WebMethod;
import javax.jws.WebResult;
import javax.jws.WebService;
import javax.jws.soap.SOAPBinding;
import javax.jws.soap.SOAPBinding.Style;
@SOAPBinding(style = Style.DOCUMENT)
public interface NodeWebService
{
public String getSubNodeInfo();
}
5、实现类
package com.test.dao;
import javax.jws.WebService;
import org.springframework.web.util.HtmlUtils;
import com.test.service.NodeWebService;
@WebService
public class DevNodeWebServiceImpl implements NodeWebService
{
public String getSubNodeInfo()
{
return "hello";
}
}
6、输入http://localhost:8080/cxf/service/如果出现下面的信息。部署成功。cxf是我的工程名.
- 五、CXF整合Spring
- CXF整合Spring
- CXF WebService整合Spring
- Spring 整合 CXF
- CXF整合Spring入门教程
- CXF WebService整合Spring
- CXF WebService整合Spring
- cxf和spring整合
- spring+cxf+bonecp整合
- CXF WebService整合Spring
- CXF Spring整合案例
- CXF WebService整合Spring
- cxf和spring整合
- CXF WebService整合Spring
- CXF WebService整合Spring
- CXF WebService整合Spring
- cxf 与 spring整合
- CXF整合spring
- 对session和cookie的一些理解
- LINQ实战读书笔记 LINQ TO SQL(一)
- WEB架构师成长必经之路
- Javase基础学习笔记之集合(3)
- html img图片等比例缩放
- CXF spring 整合
- qt信号signal和槽slot机制
- Android 访问网络系列(二)
- java深度搜索解决破碎的砝码
- openGL实现可以动的木头人
- 执行延迟IOS关于取消延迟执行函数的种种
- 第16周 项目2-去除字符串str1中的特定字符(空格),结果仍保存在原字符串中<指针做参数>
- Mahout相关笔记
- 1、CocoaPods安装和使用教程