我尝试使用以下请求[1]部分地使用magento创建销售订单货件。我得到" SOAP-ERROR:编码:违反编码规则"。任何人都可以帮我解决这个问题吗?
[1]
<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:salesOrderShipmentCreate>
<sessionId>xxxxxxxxxxxxxxxxxxxxxx</sessionId>
<orderIncrementId>200006672</orderIncrementId>
<itemsQty><orderItemIdQty><order_item_id>AG0102019</order_item_id><qty>1.0</qty></orderItemIdQty></itemsQty>
<comment>Testing</comment>
<email>1</email>
</urn:salesOrderShipmentCreate>
</soapenv:Body>
</soapenv:Envelope>
提前致谢
答案 0 :(得分:0)
我找到了这个问题的根本原因。 order_item_id是整数类型元素,传递的值是字符串。因此,“违反编码规则”问题就出现了。
请求应该是这样的,
<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:salesOrderShipmentCreate soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<sessionId>xxxxxxxxxxxxxxxxx</sessionId>
<orderIncrementId>200006672</orderIncrementId>
<itemsQty>
<urn:orderItemIdQty>
<order_item_id>13066</order_item_id>
<qty>1.0</qty>
</urn:orderItemIdQty>
</itemsQty>
</urn:salesOrderShipmentCreate>
</soapenv:Body>
</soapenv:Envelope>