(细节具体Magento的1.6.x版,但技巧,如果没有细节,应适用于其他版本)
我假设的基础上,您的代码示例,您使用的是PHP客户端代码测试方法的存在性,然后您可以将其应用于C#应用程序的调用?
假设是这样,这意味着你知道PHP,所以你需要在Magento soap服务器PHP级别进行调试。唯一的类文件产生故障
app/code/core/Mage/Api/Model/Server/Handler/Abstract.php
不管是临时的,直接添加以下记录到该文件,或在
app/code/local/Mage/Api/Model/Server/Handler/Abstract.php
下降的类文件的拷贝,codepool覆盖。
看在类文件以下异常
throw new Mage_Api_Exception('resource_path_not_callable')
这是Magento的SOAP服务器是什么原因引起来的响应与故障。这个文件中有四个地方发生。在每个之上添加日志记录调用。
Mage::Log(sprintf('Line %s in file %s',__LINE__, __FILE__));
throw new Mage_Api_Exception('resource_path_not_callable');
这会让你知道哪个故障导致你的问题,从中你可以进一步调试和记录。有两个地方可能发生(文件中共有四个,一个用于常规呼叫,另一个用于多路呼叫)。
按照出现的顺序,在评论中可能的原因。
//here magento is attempting to instantiate the "API Model" that will perform
//the work of your API call. Upon instantiation, it discovers that the model
//doesn't inherit from Mage_Api_Model_Resource_Abstract, and bails.
//This is rare for a non-custom API call, but might be caused by a class rewrite
//gone amuck, or a very hacked system
try {
$model = Mage::getModel($modelName);
if ($model instanceof Mage_Api_Model_Resource_Abstract) {
$model->setResourceConfig($resources->$resourceName);
}
} catch (Exception $e) {
Mage::Log(sprintf('Line %s in file %s',__LINE__, __FILE__));
throw new Mage_Api_Exception('resource_path_not_callable');
}
//Here Magento's been able to instantiate the $model, and is checking if the method is
//callable. If not, it bails. Again, for a standard, stock API call this shouldn't
//be happening, but could be the result of a rewrite gone wrong, or someone hacking an
//api class to make the method non accesible, or someone hacking the method mapping in api.xml
if (is_callable(array(&$model, $method))) {
if (isset($methodInfo->arguments) && ((string)$methodInfo->arguments) == 'array') {
return $model->$method((is_array($args) ? $args : array($args)));
} elseif (!is_array($args)) {
return $model->$method($args);
} else {
return call_user_func_array(array(&$model, $method), $args);
}
} else {
Mage::Log(sprintf('Line %s in file %s',__LINE__, __FILE__));
throw new Mage_Api_Exception('resource_path_not_callable');
}
找出Magento为什么会抛出API错误。它会经常指向你的肥皂呼叫中的一个类型,或者指向你在PHP系统中被黑掉的东西
错误的哪个部分你不完全明白吗?你能详细说明吗? – hakre 2011-12-15 13:42:12
http:// localhost/api/v2_soap /?wsdl在浏览器中打开它看看是否有这样的方法catalogProductCreate – 2011-12-15 13:53:48