简体   繁体   中英

Android Magento Soap PersistenceException in ElementList

I get the error

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

when I make request to fetch catalogProductMedia from Magento using Soap. Below are XML files and Classes.

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

i just want to fetch url and i have already generated all the getter and setter methods. Help Me Please

Try to annotate result like

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM