2017-01-31 32 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> 
相关问题