【webservice】CXF结合spring发布简单的webservice服务
本文先发布在:封宸落宇 ? ?再同步发布到本博客! CXF结合spring发布简单的webservice服务!
1、创建web工程 ,添加spring(3.1.3)包,添加cxf(2.2.6)依赖包 2、创建配置文件:applicationContext-webservice.xml 文件内容:
?然后在applicationContext.xml中将applicationContext-webservice.xml添加进来。 ? 3、在web.xml中,添加cxf servlet定义! |
<
servlet
>
????????
<
servlet
-
name
>
UserPrdBindService
<
/
servlet
-
name
>
????????
<
servlet
-
class
>
org
.
apache
.
cxf
.
transport
.
servlet
.
CXFServlet
<
/
servlet
-
class
>
????????
<
load
-
on
-
startup
>
1
<
/
load
-
on
-
startup
>
????????
<
/
servlet
>
?
????????
<
servlet
-
mapping
>
????????
<
servlet
-
name
>
UserPrdBindService
<
/
servlet
-
name
>
????????
<
url
-
pattern
>
/
UserPrdBindService
/
*
<
/
url
-
pattern
>
????????
<
/
servlet
-
mapping
>
|
上面定义的cxfservlet对于URL中带有UserPrdBindService的请求都将过滤,对于上面的定义访问:http://ip/UserPrdBindService/SyncAddressBookService?wsdl就能够访问到发布的服务。
?
4、创建服务接口
?/
5、创建接口实现类
6、部署并启动,访问:http://ip/UserPrdBindService/SyncAddressBookService?wsdl ?能够获取到wsdl文件,恭喜你已经成功利用cxf结合spring发布了一个webservice服务了!
服务发布了,那怎么访问呢,请查看我的另一篇博客!!
(编辑:李大同)
【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!