服务端
一、准备cxf的jar包:apache-cxf-2.7.11(在这里我用的是这个版本)
WebService的CXF框架整合Spring

二、准备完jar包后去新建项目和接口
WebService的CXF框架整合Spring

接口和实现类
WebService的CXF框架整合Spring
WebService的CXF框架整合Spring

三、然后去配置applicationContext_cxfbean.xml
WebService的CXF框架整合Spring

四、把applicationContext_cxfbean.xml配置到web.xml里面
WebService的CXF框架整合Spring

五、发布
wsdl2java -p com.asit.client.direct -d . http://localhost:4000/scwp/webservice/DirectService?wsdl

客户端:
一、新建一个项目
WebService的CXF框架整合Spring

二、配置cxf的环境
WebService的CXF框架整合Spring

在path里我把apache-cxf-2.7.11的bin路径配在里面
WebService的CXF框架整合Spring

WebService的CXF框架整合Spring

三 、生成类
cd 到你的项目src下运行wsdl2java -p com.asit.client.direct -d . http://localhost:4000/scwp/webservice/DirectService?wsdl
如图:
WebService的CXF框架整合Spring
然后会在你的com.asit.client.direct 包下生成你需要的类
WebService的CXF框架整合Spring

四、编写客户端配置文件
WebService的CXF框架整合Spring

五、编写测试类
WebService的CXF框架整合Spring

相关文章: