XFire开发Web Service

XFire的部分配置:(原创额!眨眼)

<!-- XFire 配置Start -->
 
 <bean id="namingTransactionAttribute"
  class="org.springframework.transaction.interceptor.NameMatchTransactionAttributeSource">
  <property name="properties">
   <props>
    <prop key="insert*">PROPAGATION_REQUIRED</prop>
    <prop key="create*">PROPAGATION_REQUIRED</prop>
    <prop key="update*">PROPAGATION_REQUIRED</prop>
    <prop key="save*">PROPAGATION_REQUIRED</prop>
    <prop key="del*">PROPAGATION_REQUIRED</prop>
    <prop key="*">PROPAGATION_REQUIRED,readOnly</prop>
   </props>
  </property>
 </bean>
 
 <bean id="baseTransactionProxy"
  class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean"
  abstract="true">
  <property name="transactionManager" ref="transactionManager" />
  <property name="transactionAttributeSource">
   <ref bean="namingTransactionAttribute" />
  </property>
 </bean>
 <!--  高级查询Start -->
 <bean id="StatisticalQueryService" parent="baseWebService">
<!--   业务服务bean -->
  <property name="serviceBean" ref="baseServiceOfStatisticalQueryService" />
<!--   业务服务bean的窄接口类 -->
  <property name="serviceClass" value="com.hjdf.cnmsa.law.service.StatisticalQueryService" />
 </bean>
 
 <bean id="baseServiceOfStatisticalQueryService" parent="baseTransactionProxy">
  <property name="proxyInterfaces">
   <list>
    <value>com.hjdf.cnmsa.law.service.StatisticalQueryService</value>
   </list>
  </property>
  <property name="target">
   <ref bean="baseserviceTargetOfStatisticalQueryService" />
  </property>
 </bean>
 
<!-- StatisticalQueryDao 要区分 注解:@Repository(value = "statisticalQueryDao") 否则报NullPoint异常  -->
 <bean id="baseserviceTargetOfStatisticalQueryService" class="com.hjdf.cnmsa.law.service.impl.StatisticalQueryServiceImpl">
  <property name="StatisticalQueryDao">
   <ref bean="StatisticalQueryDao" />
  </property>
 </bean>
 
 <bean id="StatisticalQueryDao" class="com.hjdf.cnmsa.law.dao.impl.StatisticalQueryDaoImpl">
  <property name="sessionFactory">
   <ref bean="sessionFactory"></ref>
  </property>
 </bean>
 
 <import resource="classpath:org/codehaus/xfire/spring/xfire.xml" />
 <bean class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
  <property name="urlMap">   
    <map>
     <entry key="/StatisticalQueryService.ws">
      <list>
       <ref bean="StatisticalQueryService" />
      </list>
     </entry>
    </map> 
  </property>
 </bean>
 
<!--  高级查询End -->
 
 <bean id="punishmentSnapshotDao" class="com.hjdf.cnmsa.law.dao.impl.PunishmentSnapshotDaoImpl">
  <property name="sessionFactory">
   <ref bean="sessionFactory"></ref>
  </property>
 </bean>
 
 <bean id="baseserviceTarget" class="com.hjdf.cnmsa.law.service.impl.PunishmentSnapshotServiceImpl">
  <property name="punishmentSnapshotDao">
   <ref bean="punishmentSnapshotDao" />
  </property>
 </bean>
 
 <bean id="baseService" parent="baseTransactionProxy">
  <property name="proxyInterfaces">
   <list>
    <value>com.hjdf.cnmsa.law.service.PunishmentSnapshotService</value>
   </list>
  </property>
  <property name="target">
   <ref bean="baseserviceTarget" />
  </property>
 </bean>
 
 <import resource="classpath:org/codehaus/xfire/spring/xfire.xml" />
 <bean class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
  <property name="urlMap">   
    <map>
     <entry key="/PunishmentSnapshotService.ws">
      <list>
       <ref bean="PunishmentSnapshotService" />
      </list>
     </entry>
    </map> 
  </property>
 </bean>
 
 <bean id="baseWebService" class="org.codehaus.xfire.spring.remoting.XFireExporter"
  lazy-init="false" abstract="true">
  <!-- 引用xfire.xml中定义的工厂 -->
  <property name="serviceFactory" ref="xfire.serviceFactory"/>
  <!-- 引用xfire.xml中的xfire实例 -->
  <property name="xfire" ref="xfire" />
 </bean>

 <bean id="PunishmentSnapshotService" parent="baseWebService">
  <!-- 业务服务bean -->
  <property name="serviceBean" ref="baseService" />
  <!-- 业务服务bean的窄接口类 -->
  <property name="serviceClass" value="com.hjdf.cnmsa.law.service.PunishmentSnapshotService" />
 </bean>
 <!-- XFire 配置End -->

猜你喜欢

转载自dashuaifu.iteye.com/blog/2107055