gpt4 book ai didi

java - ElementList 中的 Android Magento Soap PersistenceException

转载 作者:行者123 更新时间:2023-11-30 01:33:54 26 4
gpt4 key购买 nike

我得到了错误

Android Magento Soap Api org.simpleframework.xml.core.PersistenceException: Element 'result' is already used with @org.simpleframework.xml.ElementList

当我请求使用 Soap 从 Magento 获取 catalogProductMedia 时。下面是 XML 文件和类。

CatalogProductAttributeMediaListResponse.xml

<message name="catalogProductAttributeMediaListResponse">
<part name="result" type="typens:catalogProductImageEntityArray"/>
</message>

CatalogProductAttributeMediaListResponse.java

    @Root(name = CatalogProductAttributeMediaListResponse.ROOT_NAME, strict = false)
public class CatalogProductAttributeMediaListResponse {

public static final String ROOT_NAME = "n0:catalogProductAttributeMediaListResponse";

@Element(required = false)
@Path("Body/catalogProductAttributeMediaListResponse")
private CatalogProductImageEntityArray result;
}

CatalogProductImageEntityArray.xml

<complexType name="catalogProductImageEntityArray">
<complexContent>
<restriction base="soapenc:Array">
<attribute ref="soapenc:arrayType" wsdl:arrayType="typens:catalogProductImageEntity[]"/>
</restriction>
</complexContent>
</complexType>

CatalogProductImageEntityArray.java

@Root(name = "catalogProductImageEntityArray", strict = false)
public class CatalogProductImageEntityArray {
@ElementList(inline = true, entry = "item", required = false)
private List<CatalogProductImageEntity> productImageEntityList;
}

CatalogProductImageEntity.xml

<complexType name="catalogProductImageEntity">
<all>
<element name="file" type="xsd:string"/>
<element name="label" type="xsd:string"/>
<element name="position" type="xsd:string"/>
<element name="exclude" type="xsd:string"/>
<element name="url" type="xsd:string"/>
<element name="types" type="typens:ArrayOfString"/>
</all>
</complexType>

CatalogProductImageEntity.java

@Root(name = "catalogProductEntity", strict = false)
public class CatalogProductImageEntity {
@Element(required = false)
private String url;
}

我只想获取 url,我已经生成了所有的 getter 和 setter 方法。请帮助我

最佳答案

尝试像这样注释结果

@Element(required = false, inline=true)
@Path("Body/catalogProductAttributeMediaListResponse")
private CatalogProductImageEntityArray result;

关于java - ElementList 中的 Android Magento Soap PersistenceException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35362398/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com