如有以下接口
package com.efs.xfire.pojo;
import java.util.*;
public interface CollectionsDemo {
public int getCollectionsRowCount(List list);
public List getUserList();
}
import java.util.*;
public interface CollectionsDemo {
public int getCollectionsRowCount(List list);
public List getUserList();
}
在該接口的同一包下,需進行如下配置
<?xml version="1.0" encoding="UTF-8"?>
<mappings>
<mapping>
<method name="getCollectionsRowCount">
<parameter index="0" componentType="java.lang.String"/>
</method>
<!-- 返回的類型是Map的話,做法和List一樣。但定義的類型,是Map中的Value部分 -->
<method name="getUserList">
<return-type componentType="com.efs.xfire.entity.User"/>
</method>
</mapping>
</mappings>
只要是類中的方法返回類型或參數是對象類型(除java基本類型外或類集)都需要做相關的配置。<mappings>
<mapping>
<method name="getCollectionsRowCount">
<parameter index="0" componentType="java.lang.String"/>
</method>
<!-- 返回的類型是Map的話,做法和List一樣。但定義的類型,是Map中的Value部分 -->
<method name="getUserList">
<return-type componentType="com.efs.xfire.entity.User"/>
</method>
</mapping>
</mappings>
要作為WS發布的類務類,都需要在services.xml文件中作相應的配置
<beans xmlns="http://xfire.codehaus.org/config/1.0">
<service>
<name>HelloWorldService</name>
<namespace>http://efs.com/HelloWorldService</namespace>
<serviceClass>
com.efs.xfire.pojo.HelloWorldService
</serviceClass>
<implementationClass>
com.efs.xfire.pojo.HelloWorldServiceImpl
</implementationClass>
</service>
</beans>
<service>
<name>HelloWorldService</name>
<namespace>http://efs.com/HelloWorldService</namespace>
<serviceClass>
com.efs.xfire.pojo.HelloWorldService
</serviceClass>
<implementationClass>
com.efs.xfire.pojo.HelloWorldServiceImpl
</implementationClass>
</service>
</beans>