2010-07-13 31 views
2

我正在問的Magento時與下面的請求訪問被拒絕:Magento的catalogProductInfo - 訪問被拒絕原因不明

<?xml version="1.0" encoding="UTF-8"?> 
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 
    <soapenv:Body> 
     <ns1:catalogProductInfo soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" 
           xmlns:ns1="urn:Magento"> 
      <sessionId xsi:type="xsd:string">xxxxxxxxxxxxxxx</sessionId> 
      <productId xsi:type="xsd:string">119</productId> 
      <storeView xsi:type="xsd:string" xsi:nil="true"/> 
      <attributes xsi:type="ns1:catalogProductRequestAttributes" xsi:nil="true"/> 
     </ns1:catalogProductInfo> 
    </soapenv:Body> 
</soapenv:Envelope> 

這裏是迴應:

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"> 
<SOAP-ENV:Body> 
    <SOAP-ENV:Fault> 
     <faultcode>2</faultcode> 
     <faultstring>Access denied.</faultstring> 
    </SOAP-ENV:Fault> 
</SOAP-ENV:Body> 
</SOAP-ENV:Envelope> 

會話ID是正確的,我可以做其他請求但catalogProductInfo只是失敗。我正在使用Java和Axis 1.4來訪問Magento。

回答

1

實際的原因是,API是使用沒有任何產品訪問權限的角色訪問的。

您應該爲訪問此API的用戶角色啓用產品訪問權限。

+0

用戶角色也是簡單登錄所必需的。這個答案幫助我擺脫了泡菜。謝謝! – 2011-06-01 09:01:00