您的位置:首页 > 其它

CXF服务端客户端配置详解

2014-11-05 17:01 316 查看
服务端:

<!--  CXF 配置  --> 
< servlet > 
< servlet-name > CXFServlet </ servlet-name > 
< servlet-class > org.apache.cxf.transport.servlet.CXFServlet </ servlet-class > 
< load-on-startup > 1 </ load-on-startup > 
</ servlet > 
< servlet-mapping > 
< servlet-name > CXFServlet </ servlet-name > 
< url-pattern > /services/* </ url-pattern > 
</ servlet-mapping >

在spring配置文件里

  <!-- WebService部分 -->

  <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="pwimpl" class="com.huisou.point.webservice.impl.PointWsImpl" />

  <jaxws:endpoint id="pointWs" implementor="#pwimpl"

    address="/pmw" />

 

接口的实现类
a7d7


@WebService(endpointInterface="com.huisou.point.webservice.PointWs")  

public class PointWsImpl implements PointWs {

  @Resource

  private PointMng pm;

 

 

  public int dealPoint(Integer companyId, Integer userId, Integer pointType) {

    return pm.dealPoint(companyId, userId, pointType);

  }

 

  public int getPoint(Integer userId) {

       return pm.getPoint(userId);

  }

}

 注意:都要在顶部加上@webservice通配符

 

====================================================================================

客户端:

 

  <bean id="pw" class="cms.huisou.info.manage.PointMng"    factory-bean="clientFactory" factory-method="create" />

  <bean id="clientFactory" class="org.apache.cxf.jaxws.JaxWsProxyFactoryBean">

    <property name="serviceClass" value="cms.huisou.info.manage.PointMng" />

    <property name="address" value="http://e.huisou.com/ws/pmw" />

  </bean>

 
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: