2017-01-31 31 views
0

我試圖用以下請求[1]部分在magento中創建銷售訂單出貨。我得到「SOAP-ERROR:編碼:違反編碼規則」。任何人都可以幫我解決這個問題嗎?部分創建銷售訂單出貨的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> 

在此先感謝

回答

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> 
相關問題