【发布时间】:2011-10-24 15:19:44
【问题描述】:
我正在开发一个 magento 脚本,以使用 API 和 SOAP wsdl 连接从 XML 文件导入产品。
我想知道故障码列表,我找了好几天都没有运气,有谁知道有没有,在哪里可以找到?
我需要处理错误代码以避免代码停止,而不是仅仅跳过错误并继续导入正确的内容。
目前我刚刚发现故障代码 101 是“产品不存在”。
【问题讨论】:
我正在开发一个 magento 脚本,以使用 API 和 SOAP wsdl 连接从 XML 文件导入产品。
我想知道故障码列表,我找了好几天都没有运气,有谁知道有没有,在哪里可以找到?
我需要处理错误代码以避免代码停止,而不是仅仅跳过错误并继续导入正确的内容。
目前我刚刚发现故障代码 101 是“产品不存在”。
【问题讨论】:
以下是获取您的 Magento 版本列表的方法。 (我无法想象这在版本之间会有根本的不同,但人们永远不知道系统做了什么)
找到您所有的 api.xml 文件。
$ find app/code/core -name 'api.xml'
app/code/core/Mage/Api/etc/api.xml
app/code/core/Mage/Catalog/etc/api.xml
app/code/core/Mage/CatalogInventory/etc/api.xml
app/code/core/Mage/Checkout/etc/api.xml
app/code/core/Mage/Core/etc/api.xml
app/code/core/Mage/Customer/etc/api.xml
app/code/core/Mage/Directory/etc/api.xml
app/code/core/Mage/Downloadable/etc/api.xml
app/code/core/Mage/GiftMessage/etc/api.xml
app/code/core/Mage/Sales/etc/api.xml
app/code/core/Mage/Tag/etc/api.xml
每个文件将有一个或多个<faults/> 节点,其中包含代码和消息。
<!-- File: app/code/core/Mage/CatalogInventory/etc/api.xml -->
<faults module="cataloginventory">
<not_exists>
<code>101</code>
<message>Product not exists.</message>
</not_exists>
<not_updated>
<code>102</code>
<message>Product inventory not updated. Details in error message.</message>
</not_updated>
</faults>
值得一提的是,数字代码不是唯一的。每个“肥皂对象”(不确定如何称呼它们)都定义了自己的。
<!-- File: app/code/core/Mage/Sales/etc/api.xml -->
<faults module="sales">
<not_exists>
<code>100</code>
<message>Requested order not exists.</message>
</not_exists>
<filters_invalid>
<code>101</code>
<message>Invalid filters given. Details in error message.</message>
</filters_invalid>
祝你好运!
【讨论】: