首页 > 代码库 > apache-cxf-2.6.3 spring集成配置

apache-cxf-2.6.3 spring集成配置

 apache-cxf-2.6.3
 <?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:jaxws="http://cxf.apache.org/jaxws"
 xmlns:jaxrs="http://cxf.apache.org/jaxrs"
 xsi:schemaLocation="
  http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
     http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
     http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd
     http://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/jaxrs.xsd">
 <jaxrs:server id="xx" address="/xx/api">
  <jaxrs:serviceBeans> 
   <ref bean="xx"/>
        </jaxrs:serviceBeans>
 
 <jaxrs:inInterceptors>
   <ref bean="serverInterceptor"/>
  </jaxrs:inInterceptors>
  
  <jaxrs:providers>
         <ref bean="jsonProvider"/>
         <ref bean="errorHandlerProvider"/>         
        </jaxrs:providers>
 </jaxrs:server>
 
 <bean id="serverInterceptor" class="xx.RestServerInterceptor">
 </bean>
 <!--客户端拦截器-->
 <bean id="clientInterceptor" class="xx.RestClientInterceptor"></bean>
 
 <jaxrs:client id="messageRestService" address="http://xx"
  serviceClass="xx" inheritHeaders="true" >
  <jaxrs:outInterceptors> 
   <ref bean="clientInterceptor"/>
  </jaxrs:outInterceptors>
  <jaxrs:providers>
      <ref bean="jsonProvider"/>
     </jaxrs:providers>
 </jaxrs:client> 
  <jaxws:client id="xx" address="${xx}"
  serviceClass="xx.IQueryWebService">
 </jaxws:client>  
</beans>


@Path("/xx")
@Produces("application/json")
@Consumes("application/json")
public interface Iervice {
 @GET
 @Path("listAz/page/{pageSize}/{curPage}")
 public xx<xx> xx(@QueryParam("") xx computeVO, @PathParam("") xx xx)throws  Exception;
}