I’ve got a problem with a web service which has an array or List as parameter. Here is example:
@WebMethod public String printList(@WebParam(name = "list") List<String> list) { String result = ""; if(list == null) { result = "list is null"; } else if(list.size() == 0) { result = "list is empty"; } else { for(String elem : list) { result += elem + " "; } } return result; }
When I call printList from web service client the result is always “list is empty” The same is when I use array of String. Should I use some additional annotations or something?
Advertisement
Answer
Your code is perfect, it seems you are calling it wrong way,
and you can remove second condition directly second else will work