java - Magento catalogProductInfo - 访问因未知原因被拒绝

标签 java php soap magento axis

当我向 Magento 提出以下请求时,访问被拒绝:

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

session ID 正确,我可以执行其他请求,但 catalogProductInfo 失败了。我正在使用 Java 和 Axis 1.4 访问 Magento。

最佳答案

实际原因是使用没有任何产品访问权限的角色访问 API。

您应该为访问此 API 的用户角色启用产品访问权限。

关于java - Magento catalogProductInfo - 访问因未知原因被拒绝,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3236393/

相关文章:

php - 用于从 URL 中删除 http ://and www. 的正则表达式

php - 解析由 html 表单发布的 php 中的数组

php - 从 PHP SOAP 服务器获取接收到的 XML

java - 如何在 Java 中进行 SOAP 调用

java - GSON反序列化字符串或字符串数​​组

php - 为我的情况分页?

java - 使用ajax发送大量json数据到 Controller

javascript - 使用 npm 请求向 SOAP api 发送帖子

java - 从静态方法调用非静态方法

java - 使用 JSF 2.0/Facelets,有没有办法将全局监听器附加到所有 AJAX 调用?