我收到错误
Android Magento Soap Api org.simpleframework.xml.core.PersistenceException:元素'结果'已经与@ org.simpleframework.xml.ElementList一起使用
当我使用Soap请求从Magento获取catalogProductMedia时。以下是XML文件和类。
<message name="catalogProductAttributeMediaListResponse">
<part name="result" type="typens:catalogProductImageEntityArray"/>
</message>
@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;
}
<complexType name="catalogProductImageEntityArray">
<complexContent>
<restriction base="soapenc:Array">
<attribute ref="soapenc:arrayType" wsdl:arrayType="typens:catalogProductImageEntity[]"/>
</restriction>
</complexContent>
</complexType>
@Root(name = "catalogProductImageEntityArray", strict = false)
public class CatalogProductImageEntityArray {
@ElementList(inline = true, entry = "item", required = false)
private List<CatalogProductImageEntity> productImageEntityList;
}
<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>
@Root(name = "catalogProductEntity", strict = false)
public class CatalogProductImageEntity {
@Element(required = false)
private String url;
}
我只想获取网址,我已经生成了所有的getter和setter方法。请帮助我
答案 0 :(得分:1)
尝试注释结果
@Element(required = false, inline=true)
@Path("Body/catalogProductAttributeMediaListResponse")
private CatalogProductImageEntityArray result;