簡體   English   中英

ElementList中的Android Magento Soap PersistenceException

[英]Android Magento Soap PersistenceException in ElementList

我得到錯誤

Android Magento Soap Api org.simpleframework.xml.core.PersistenceException:元素“結果”已與@ 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;

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM