Magento肥皂api显示无效的api路径

时间:2016-04-12 14:40:16

标签: magento

我已经创建了一个Web服务但是它运行不正常显示无效的api路径,即使我声明的标识符是正确的。

以下是我的代码

testapi.php(点击网址的主要文件)



<?php
// custom api soap client example
$mageFilename = '../app/Mage.php';
require_once $mageFilename;
umask(0);
Mage::app();
$myhellomsg = "<b>Helloworld Prashant</b>";
try {
$soap = new SoapClient('http://localhost:81/magento/api/?wsdl');
$sessionId = $soap->login('admin', '123456');
//echo "Login ID : $sessionId";
$result = $soap->call($sessionId, 'customapi.hello',array($myhellomsg));
echo $result;
}
catch(Exception $e) {
echo $e->getMessage();
}
&#13;
&#13;
&#13;

Api.php文件

&#13;
&#13;
<?php
class Prashant_Customapi_Model_Helloworld_Api extends Mage_Api_Model_Resource_Abstract
{
public function hello($msg) {
return "My Custom HelloWorld API In Magento. Here is Your Message ". $msg ;
}
}
&#13;
&#13;
&#13;

api.xml文件

&#13;
&#13;
<?xml version="1.0"?>
<config>
<api>
<resources>
<customapi translate="title" module="customapi">
<model>customapi/helloworld_api</model>
<title>Custom HelloWorld API </title>
<methods>
<hello translate="title" module="customapi">
<title>Prashant HelloWorld API</title>
<method>hello</method>
</hello>
</methods>
<faults module="customapi">
<data_invalid>
<code>100</code>
<message>Invalid data</message>
</data_invalid>
</faults>
</customapi>
</resources>
</api>
</config>
&#13;
&#13;
&#13;

如果还有其他需要,请告诉我。

0 个答案:

没有答案