【问题标题】:WSDL2Java. Apache CXF. ArrayOf{Type} to List<Type>WSDL2Java。阿帕奇 CXF。 ArrayOf{Type} 到 List<Type>
【发布时间】:2012-07-02 10:42:28
【问题描述】:

如何生成 List&lt;Type&gt; 而不是 ArrayOf{Type} ? 例如方法返回

[WebMethod]
public List<long> GetSimple()

WSDL2Java 将生成:

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;
    }
}

如何配置 CXF 和 JAXB 以使用 List&lt;Long&gt; 代替 ArrayOfLong?

【问题讨论】:

  • 您找到解决方案了吗?我目前面临同样的问题

标签: apache wsdl jaxb cxf


【解决方案1】:

两件事:

1) 确保&lt;jxb:globalBindings collectionType="indexed"/&gt; 不存在。它将所有集合转换为数组。

2) 尝试使用 @WebResult 注释强制类型

希望这会有所帮助。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2018-11-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多