用xfire实现客服端与服务端。当接收自定义对象对象时,客户端报错。求大牛指导
service
public List<User> getUserList(){
List<User> list = new ArrayList<User>();
User user = new User();
user.setName("cz");
user.setAge(12);
user.setSex("men");
user.getAddress().add("北极");
user.getAddress().add("上海");
list.add(user);
User user2 = new User();
user2.setName("zz");
user2.setAge(22);
user2.setSex("women");
user2.getAddress().add("杭州");
user2.getAddress().add("上海");
list.add(user2);
return list;
}
client
String url = "http://localhost:8080/xfireService/services/ListService";
XfireListService service = (XfireListService) ServiceFactory.getService(url, XfireListService.class);
List<Object> obj = service.getObjectList();
List<String> result = service.getStringList();
System.out.println("object---"+obj);
System.out.println("result-------------" +result);
List<User> users = service.getUserList();
//System.out.println("))))))))))))))))))))))"+users);
for(User user:users){
System.out.println(user.getName());
System.out.println(user.getSex());
for(String address :user.getAddress()){
System.out.println(address+",");
}
System.out.println("----------------------------------------");
}