首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > Web前端 >

xfire与spring结合创建webservice

2012-07-15 
xfire与spring组合创建webservice1.导入xfire-core包(有冲突包,具体哪些包见附件截图)2.创建webservice接

xfire与spring组合创建webservice

1.导入xfire-core包(有冲突包,具体哪些包见附件截图)2.创建webservice接口package byd.service;import java.util.List;import byd.entity.Commit;public interface IBaseService {public List<Commit> getList();}3.构建接口支持(为服务端提供对应数据类型,比如基本数据类型,list等,接口支持命名一般接口名称+aegis+.xml命名)IBaseService.aegis.xml<?xml version="1.0" encoding="UTF-8"?><mappings>    <mapping>        <method name="getList">            <parameter componentType="java.lang.String" />           <return-type componentType="#commit" />        </method>        <component name="commit" componentType="byd.entity.Commit"/>    </mapping></mappings>以上是返回list类型支持描述 其他普通类型可以去<component>节点4.在WEB_INF下创建xfire-servlet.xml与spring组合<?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:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx"xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd           http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd           http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd">    <!-- 引入XFire预配置信息 -->       <import resource="classpath:org/codehaus/xfire/spring/xfire.xml"/>       <!-- 定义访问的url-->       <bean class ="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">          <property name="urlMap">                           <map>                                  <entry key="/HelloWorldService.ws">                                       <ref bean="HelloWorldService"/>                                  </entry>                           </map>                   </property>            </bean>             <!-- 使用XFire导出器 -->       <bean id ="baseWebService" lazy-init="false" abstract="true">          <!--  引用xfire.xml中定义的工厂  -->          <property name="serviceFactory" ref="xfire.serviceFactory"/>          <!--  引用xfire.xml中的xfire实例  -->          <property name="xfire" ref="xfire"/>       </bean>       <bean id ="HelloWorldService"  parent="baseWebService">          <!--  业务服务bean  -->          <property name="serviceBean" ref="webService"/>          <!--  业务服务bean的窄接口类  -->          <property name ="serviceClass" value="byd.service.IBaseService"/>       </bean>  </beans>6.在web.xml配置<!--  begin XFire 配置  -->       <servlet>             <servlet-name>xfire</servlet-name>             <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>       </servlet >          <servlet-mapping>           <servlet-name>xfire</servlet-name>          <url-pattern>*.ws</url-pattern>       </servlet-mapping>       <servlet>          <!--  配合Spring容器中XFire一起工作的Servlet -->          <servlet-name>xfireServlet</servlet-name>          <servlet-class>org.codehaus.xfire.spring.XFireSpringServlet</servlet-class>       </servlet>       <servlet-mapping>          <servlet-name>xfireServlet</servlet-name>          <!--  在这个URI下开放Web Service服务  -->          <url-pattern>/service/*</url-pattern>       </servlet-mapping>      <!--  end XFire 配置  --> 
1 楼 gaolegao2008 2011-11-22   说的是个啥。有冲突怎么办呢。也不说个解决的办法。唉 2 楼 qq1988627 2011-11-23   gaolegao2008 写道说的是个啥。有冲突怎么办呢。也不说个解决的办法。唉
不是有要需要的包截图吗

热点排行