在WebServices的开发中,通常要处理处长复杂的类型,如返回的是Collection类,或参数是Collection类,或返回的是自定义对象类型,或者参数是自定义对象类型的类,都需要编写className.aegis.xml文件,这种处理方式与axis差不多一样,只不过axis是在service.wsdd中配置。
如有以下接口
package com.efs.xfire.pojo;
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基本类型外或类集)都需要做相关的配置。
要作为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>
	posted on 2007-06-26 21:26 
有猫相伴的日子 阅读(3813) 
评论(4)  编辑  收藏  所属分类: 
webservices