使用 Ksoap2 在数组中发送对象
send object inside array using Ksoap2
这是我想要通过 ksoap2 发送的代码。数组中的对象给我带来了问题。
<soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:Magento" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
<soapenv:Header/>
<soapenv:Body>
<urn:shoppingCartProductAdd soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<sessionId xsi:type="xsd:string">87a9cd5964e2dc1bf19a946a59a6175a</sessionId>
<quoteId xsi:type="xsd:int">716</quoteId>
<storeId xsi:type="xsd:string">1</storeId>
<products xsi:type="urn:shoppingCartProductEntityArray" soapenc:arrayType="urn:shoppingCartProductEntity[]">
<shoppingCartProductEntity>
<product_id>500</product_id>
<qty>1</qty>
</shoppingCartProductEntity>
</products>
</urn:shoppingCartProductAdd>
</soapenv:Body>
</soapenv:Envelope>
只需忽略 <shoppingCartProductEntity>
,对我来说一切正常。
这是我想要通过 ksoap2 发送的代码。数组中的对象给我带来了问题。
<soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:Magento" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
<soapenv:Header/>
<soapenv:Body>
<urn:shoppingCartProductAdd soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<sessionId xsi:type="xsd:string">87a9cd5964e2dc1bf19a946a59a6175a</sessionId>
<quoteId xsi:type="xsd:int">716</quoteId>
<storeId xsi:type="xsd:string">1</storeId>
<products xsi:type="urn:shoppingCartProductEntityArray" soapenc:arrayType="urn:shoppingCartProductEntity[]">
<shoppingCartProductEntity>
<product_id>500</product_id>
<qty>1</qty>
</shoppingCartProductEntity>
</products>
</urn:shoppingCartProductAdd>
</soapenv:Body>
</soapenv:Envelope>
只需忽略 <shoppingCartProductEntity>
,对我来说一切正常。