webservice返回数组问题
我用Webservice,想返回一个arrylist数组。但不知道怎么做,我的代码如下:
1。 服务端
import java.util.ArrayList;
public class BookTest {
public ArrayList echo(String str){
ArrayList al = new ArrayList();
for(int i=0;i <10;i++){
al.add("admin" + i);
}
return al;
}
}
2.客户端:
import java.util.ArrayList;
import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
public class ClientTest {
/**
* @param args
*/
public static void main(String[] args)throws Exception {
// TODO 自动生成方法存根
Service ser =new Service();
Call call = (Call) ser.createCall();
call.setTargetEndpointAddress(new java.net.URL("http://localhost:9090/ty/services/book"));
call.setOperationName("echo");
ArrayList ret = (ArrayList) call.invoke(new Object[] {"hehe,jdinf,joponf,jpnsf"});
System.out.println(ret.size());
}
}
报错信息:
Exception in thread "main" java.lang.ClassCastException: [Ljava.lang.Object;
at com.pub.ClientTest.main(ClientTest.java:18)
好像是转换错误,请各位大虾指点一下