用于部分创建销售订单发货的 SOAP 请求

问题描述 投票:0回答:1

我正在尝试使用以下请求在 magento 中部分创建销售订单发货 [1]。我收到“SOAP-错误:编码:违反编码规则”。谁能帮我解决这个问题吗?

[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>

提前致谢

magento magento-soap-api
1个回答
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>
© www.soinside.com 2019 - 2024. All rights reserved.