Alexander
Alexander

Reputation: 781

WSDL2Java. Apache CXF. ArrayOf{Type} to List<Type>

How to generate List<Type> instead ArrayOf{Type} ? For example method return

[WebMethod]
public List<long> GetSimple()

WSDL2Java will generate:

public ru.test.ws.ArrayOfLong GetSimple();

ArrayOfLong:

@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "ArrayOfLong", propOrder = {
    "_long"
})
public class ArrayOfLong
    implements Serializable
{
    @XmlElement(name = "long", type = Long.class)
    protected List<Long> _long;

    public List<Long> getLong() {
        if (_long == null) {
            _long = new ArrayList<Long>();
        }
        return this._long;
    }
}

How to configure CXF and JAXB to use List<Long> instead ArrayOfLong?

Upvotes: 9

Views: 1649

Answers (1)

OnResolve
OnResolve

Reputation: 4032

2 things:

1) make sure <jxb:globalBindings collectionType="indexed"/> doesn't exist. It will turn all collections to arrays.

2) try to force the type with the @WebResult annotation

Hope this helps.

Upvotes: 2

Related Questions