Search code examples
web-servicesapache-axispojo

Arrays as parameters in Axis2 POJO Webservices?


I'm a Axis2 / Webservice newbie and I'm trying to turn a simple POJO into a webservice (code below). The class PieceInfo is annotated with @XmlRootElement and I have a class ObjectFactory which returns a PieceInfo in a method (code below). Methods using PieceInfo work, methods using List<PieceInfo> or PieceInfo[] as parameters throw JAXB exceptions such as java.util.List is not known to this context. I thought List or array should just work fine. What am I doing wrong?

@WebService (name="KMPService",targetNamespace="http://www.ict.ie.tss/")
@MTOM
public interface KMPServiceInterface {

@WebMethod
void updateRootInfo(String username, String password, PieceInfo info);

@WebMethod
PieceInfo getRootInfo(String username, String password);

@WebMethod
void put(String username, String password, List<PieceInfo> infoList);

@WebMethod
PieceInfo[] get(String username, String password,
    PieceInfo[] infoList);

@WebMethod
void deleteEntries(String username, String password,
    PieceInfo[] infoList);

}

ObjectFacotry:

@XmlRegistry
public class ObjectFactory {

public PieceInfo createPieceInfo(){
    return new PieceInfo();
}

 }

Solution

  • Seems the answer is: Don't use Axis2. Using cxf now snd everything works with Lists and Arrays out of the box.