Spring 3 整合Apache CXF WebService[转]
2014-03-23 17:35
183 查看
http://www.cnblogs.com/hoojo/archive/2012/07/13/2590593.html
在CXF2版本中,整合Spring3发布CXFWebService就更加简单了。因为Spring3提供了annotation注解,而CXF2发布WebService已经不像之前版本的配置那样(参考老版本发布WebService系列文章:/article/4791840.html),现在发布一个WebService可以直接从Spring的IoC容器中拿到一个对象,发布成WebService服务。当然发布WebService的配置有了些小小的变动,具体请往下看。
[/code]
[/code]
jaxws:endpoint的发布方式
[/code]
[/code]
而在2.x新版本中,发布Ioc容器中的对象为一个WebService的方法
[/code]
[/code]
CXF发布WebService官方参考:http://cxf.apache.org/docs/writing-a-service-with-spring.html
在CXF2版本中,整合Spring3发布CXFWebService就更加简单了。因为Spring3提供了annotation注解,而CXF2发布WebService已经不像之前版本的配置那样(参考老版本发布WebService系列文章:
[code]<beanid="userServiceBean"class="com.hoo.service.ComplexUserService"/>
<beanid="inMessageInterceptor"class="com.hoo.interceptor.MessageInterceptor">
<constructor-argvalue="receive"/>
</bean>
<beanid="outLoggingInterceptor"class="org.apache.cxf.interceptor.LoggingOutInterceptor"/>
<!--注意下面的address,这里的address的名称就是访问的WebService的name-->
<jaxws:serverid="userService"serviceClass="com.hoo.service.IComplexUserService"address="/Users">
<jaxws:serviceBean>
<!--要暴露的bean的引用-->
<refbean="userServiceBean"/>
</jaxws:serviceBean>
<jaxws:inInterceptors>
<refbean="inMessageInterceptor"/>
</jaxws:inInterceptors>
<jaxws:outInterceptors>
<refbean="outLoggingInterceptor"/>
</jaxws:outInterceptors>
</jaxws:server>
[/code]
[/code]
jaxws:endpoint的发布方式
[code]
[code]<!--com.hoo.service.ComplexUserService是com.hoo.service.IComplexUserService接口的实现,这种方法应该不能从Ioc中引用对象-->
<jaxws:endpointid="userService2"implementor="com.hoo.service.ComplexUserService"address="/Users">
<jaxws:inInterceptors>
<refbean="inMessageInterceptor"/>
</jaxws:inInterceptors>
<jaxws:outInterceptors>
<refbean="outLoggingInterceptor"/>
</jaxws:outInterceptors>
</jaxws:endpoint>
[/code]
[/code]
而在2.x新版本中,发布Ioc容器中的对象为一个WebService的方法
[code][code]<beanid="userServiceBean"class="com.hoo.service.ComplexUserService"/>
<beanid="inMessageInterceptor"class="com.hoo.interceptor.MessageInterceptor">
<constructor-argvalue="receive"/>
</bean>
<beanid="outLoggingInterceptor"class="org.apache.cxf.interceptor.LoggingOutInterceptor"/>
<!--注意下面的address,这里的address的名称就是访问的WebService的name;#userServiceBean是直接引用Ioc容器中的Bean对象-->
<jaxws:serverid="userService"serviceBean="#userServiceBean"address="/Users">
<jaxws:inInterceptors>
<refbean="inMessageInterceptor"/>
</jaxws:inInterceptors>
<jaxws:outInterceptors>
<refbean="outLoggingInterceptor"/>
</jaxws:outInterceptors>
</jaxws:server>
<!--或者这种方式,在老版本中这个是不能引用Ioc容器中的对象,但在2.x中可以直接用#id或#name的方式发布服务-->
<jaxws:endpointid="userService2"implementor="#userServiceBean"address="/Users">
<jaxws:inInterceptors>
<refbean="inMessageInterceptor"/>
</jaxws:inInterceptors>
<jaxws:outInterceptors>
<refbean="outLoggingInterceptor"/>
</jaxws:outInterceptors>
</jaxws:endpoint>
[/code]
[/code]
CXF发布WebService官方参考:
相关文章推荐
- Spring 3 整合Apache CXF WebService
- Apache Cxf WebService整合Spring(1)
- Spring 3 整合Apache CXF WebService
- Apache Cxf WebService整合Spring(2)
- Spring 3 整合Apache CXF WebService
- Spring 3 整合Apache CXF WebService
- Spring 整合 Apache CXF发布webService
- Spring 3 整合Apache CXF WebService
- Spring 3 整合Apache CXF WebService
- CXF Webservice 6 - Spring 3 整合Apache CXF WebService
- Apache Cxf WebService整合Spring(2)
- spring boot整合cxf发布webservice服务和cxf客户端调用
- spring boot整合cxf发布webservice服务和spring boot整合cxf客户端调用webservice服务
- CXF整合Spring整合實現WebService服務
- Spring整合CXF发布WebService
- androidpn server 通过Spring与restful webservice整合
- Spring Boot & Apache CXF 开发具有多Endpoint的 WebService
- 五、CXF WebService整合Spring
- Spring整合CXF,发布RSETful 风格WebService
- CXF WebService整合Spring