CXF 返回List的实例

Bean:

@XmlType(name = "Tower")
@XmlAccessorType(XmlAccessType.FIELD)
public class Tower {
  
    public String name;
    public String date;
 
    public String getDate() {
        return date;
    }
    public void setDate(String date) {
        this.date = date;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public Tower () {
    };

}

 

接口:

public interface IWsfb
{
    public List<Tower> browse() throws Exception;
}

 

实现类:

@WebService(endpointInterface = "com.ws.IWsfb")
@Features(features = "org.apache.cxf.feature.LoggingFeature") //soap日志输出
public class WsfbMgr implements IWsfb
{
    public List<Tower> browse() throws Exception
    {

        Tower tower = new Tower();

        tower.setName('test');

        tower.setDate('2009-10-30');

        List data = new ArrayList();
        data.add(tower);
        return data;
    }
   
}

 

注:bean一定要有个构造方法

你可能感兴趣的:(apache,bean,webservice,SOAP)