1.功能是在webservice的客户端向服务端传一个字符串数组作为参数,批量删除ip
2.但是直接用String[] ids传递的话会报异常:No message body writer found for response class : L.String[]或者之类的。后换成List<String> ids也不行,报异常:No message body writer found for response class :ArrayList
3.于是把String[] ids包装在一个自定义的类里,还是报相同的异常。
4.于是把String包装了一层变成StringVo,并加注释
@XmlRootElement
此问题得以解决
5.另外:如果用get方法传递的话肯定不行?没有尝试。
6.如果想用Arraylist直接传值的话,可参考自定义一个message provider。
http://cxf.547215.n5.nabble.com/No-message-body-writer-found-for-response-class-String-td567819.html
在IpPoolService.java中传入ip的id数组:
@Override
public
String delAllIp(String[] ids, String callType) {
//String[] to StringVo[]
StringVo[] idsVo = parseStringToStringVo(ids);
try
{
String url =
"/iaasresource/ip/delete"
;
WebClient cloudosClient = WebClientFactory.getWebClient();
Result result = cloudosClient.back(
true
).path(url)
.accept(MediaType.
APPLICATION_XML
)