2014-05-08 93 views
1

嘗試使用v2 API從magento獲取產品信息時,出現了一些有名的「產品不存在」錯誤。然而,通常的補救措施似乎都不起作用。舉例來說,我檢查這個線程:magento soap api v2 catalogProductInfo not workingmagento soap api v2目錄產品信息「產品不存在」錯誤

這裏是我的請求數據:

<?xml version="1.0" encoding="utf-8"?> 
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="urn:Magento" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> 
    <SOAP-ENV:Body> 
    <ns1:catalogProductInfo> 
     <sessionId xsi:type="xsd:string">291b294f0a5ec652069dfbd2ba1f42a3</sessionId> 
     <productId xsi:type="xsd:string">917</productId> 
    </ns1:catalogProductInfo> 
    </SOAP-ENV:Body> 
</SOAP-ENV:Envelope> 

這裏是我試過到目前爲止:

  • 驗證和regenereted會話ID
  • 用戶的完全訪問權限
  • 多個產品ID(已驗證存在,無論是在管理員還是使用目錄產品清單中)
  • 同時使用ID和SKU
  • SKU與<storeView>參數
  • 添加<productIdentifierType>參數的上述

接下來會發生什麼

  • 組合是
  • 後方的空間添加?

  • 回答

    4

    我找到了一個解決方案:事實證明http://www.magentocommerce.com/api/soap/catalog/catalogProduct/catalog_product.info.html上的magento文檔是錯誤的。參數「productId」實際上被稱爲「產品」。所以我的工作代碼是:

    <?xml version="1.0" encoding="utf-8"?> 
    <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="urn:Magento" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> 
        <SOAP-ENV:Body> 
        <ns1:catalogProductInfo> 
         <sessionId xsi:type="xsd:string">291b294f0a5ec652069dfbd2ba1f42a3</sessionId> 
         <product xsi:type="xsd:string">917</product> 
        </ns1:catalogProductInfo> 
        </SOAP-ENV:Body> 
    </SOAP-ENV:Envelope> 
    

    在哪裏報告文檔中的錯誤?

    +0

    ...現在我注意到它也被稱爲wsdl中的「產品」。 Evenso,文件應該更正。 – DukeOf1Cat

    1

    我正在使用C#和SOAP訪問magento API。

    我有同樣的問題(產品不存在)和我的解決辦法是離開最後一個參數作爲null""

    details = service.catalogProductInfo(sessionId, prod.sku, null, null, ""); 
    

    details = service.catalogProductInfo(sessionId, prod.product_id, null, null, ""); 
    

    的文件似乎是說你應該把「SKU」或「PRODUCT_ID」(或「產品」爲我所看到別人說的),但是這並沒有爲工作我。

    您可以使用skuproduct_id作爲第二個參數。

    sku之後的空間(正如其他人所建議的那樣)是沒有必要的。

    +1

    我只贊同謝謝你提及我可以在SKU之後添加空格。這解決了我的問題。 – DependencyHell

    0

    我有同樣的問題,在我的情況下,這是由於Magento從1.7更新到1.9。他們更改了catalogProductInfo的WSDL(以及其他更改)。我使用自動生成的C#代碼訪問API,並且必須更新它(在Visual Studio中:右鍵單擊API並單擊「更新服務參考」)。

    (這通常是不值得的答案,除外當你不通知了服務器的升級,你可以瞭解發生了什麼事之前相當長一段時間搜索,所以我希望這可以幫助別人)