I am trying to create custom api in magento
I am getting Below 2 errors
- While calling webservice
EXCEPTION=SoapFault exception: [4] Resource path is not callable. in D:\xampp\htdocs*****\CustomApiCaller.php:22 Stack trace: #0 D:\xampp\htdocs****\CustomApiCaller.php(22): SoapClient->__call('folderMyapimeth...', Array) #1 D:\xampp\htdocs*****\CustomApiCaller.php(22): SoapClient->folderMyapimethod('2ac263f18e06b89...', NULL) #2 {main}
- While browsing Edit role page form back end
Fatal error: Class 'Mage_Mymodule_Helper_Data' not found in D:\xampp\htdocs*****\app\Mage.php on line 547
Below are my files
Folder Structute
MyCompany_MyModule.xml
<?xml version="1.0"?>
<config>
<modules>
<MyCompany_MyModule>
<active>true</active>
<codePool>local</codePool>
</MyCompany_MyModule>
</modules>
</config>
Config.xml
<?xml version="1.0"?>
<config>
<modules>
<Mycompany_Mymodule>
<version>1.0.0</version>
</Mycompany_Mymodule>
</modules>
<global>
<models>
<MyModule>
<class>MyCompany_MyModule_Model</class>
</MyModule>
</models>
<!--<helpers>
<MyModule>
<class>MyCompany_MyModule_Helper</class>
</MyModule>
</helpers>-->
</global>
</config>
Note - Here i tried both(without commenting helpers node also but not luck.
Api.xml
<?xml version="1.0"?>
<config>
<modules>
<Mymodule>
<version>1.0.0</version>
</Mymodule>
</modules>
<api>
<resources>
<mymodule_folder translate="title" module="mymodule">
<title>mymodule</title>
<model>mymodule/folder_api</model>
<acl>mymodule/folder</acl>
<methods>
<myapimethod translate="title" module="mymodule">
<title>myapimethod</title>
<acl>mymodule/folder/myapimethod</acl>
</myapimethod>
</methods>
</mymodule_folder>
</resources>
<resources_alias>
<folder>mymodule_folder</folder>
</resources_alias>
<v2>
<resources_function_prefix>
<folder>folder</folder>
</resources_function_prefix>
</v2>
<acl>
<resources>
<mymodule translate="title" module="mymodule">
<title>mymodule</title>
<sort_order>1</sort_order>
<folder translate="title" module="mymodule">
<title>Folder</title>
<sort_order>2000</sort_order>
<myapimethod translate="title" module="mymodule">
<title>myapimethod</title>
</myapimethod>
</folder>
</mymodule>
</resources>
</acl>
</api>
</config>
wsdl.xml
<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns:typens="urn:{{var wsdl.name}}" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns="http://schemas.xmlsoap.org/wsdl/"
name="{{var wsdl.name}}" targetNamespace="urn:{{var wsdl.name}}">
<types>
<schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="urn:Magento">
<import namespace="http://schemas.xmlsoap.org/soap/encoding/" schemaLocation="http://schemas.xmlsoap.org/soap/encoding/" />
</schema>
</types>
<message name="folderMyapimethodRequest">
<part name="sessionId" type="xsd:string"/>
<part name="message" type="xsd:string" />
</message>
<message name="folderMyapimethodResponse">
<part name="result" type="xsd:string" />
</message>
<portType name="{{var wsdl.handler}}PortType">
<operation name="folderMyapimethod">
<documentation>this is an example of api method...</documentation>
<input message="typens:folderMyapimethodRequest" />
<output message="typens:folderMyapimethodResponse" />
</operation>
</portType>
<binding name="{{var wsdl.handler}}Binding" type="typens:{{var wsdl.handler}}PortType">
<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http" />
<operation name="folderMyapimethod">
<soap:operation soapAction="urn:{{var wsdl.handler}}Action" />
<input>
<soap:body namespace="urn:{{var wsdl.name}}" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
</input>
<output>
<soap:body namespace="urn:{{var wsdl.name}}" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
</output>
</operation>
</binding>
<service name="{{var wsdl.name}}Service">
<port name="{{var wsdl.handler}}Port" binding="typens:{{var wsdl.handler}}Binding">
<soap:address location="{{var wsdl.url}}" />
</port>
</service>
</definitions>
wsi.xml
<wsdl:portType name="{{var wsdl.handler}}PortType">
<wsdl:operation name="folderMyapimethod">
<wsdl:documentation>Retrieve list of deal</wsdl:documentation>
<wsdl:input message="typens:folderMyapimethodRequest" />
<wsdl:output message="typens:folderMyapimethodResponse" />
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="{{var wsdl.handler}}Binding" type="typens:{{var wsdl.handler}}PortType">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
<wsdl:operation name="folderMyapimethod">
<soap:operation soapAction="" />
<wsdl:input>
<soap:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="{{var wsdl.name}}Service">
<wsdl:port name="{{var wsdl.handler}}Port" binding="typens:{{var wsdl.handler}}Binding">
<soap:address location="{{var wsdl.url}}" />
</wsdl:port>
</wsdl:service>
Note - I also tried bu not using wsi.xml file but not luck because compliance is set to no in back end.
Api.php ##
<?php
class Mycompany_Mymodule_Model_Folder_Api extends Mage_Api_Model_Resource_Abstract
{
public function myapimethod( $message)
{
return "This is the message: ".$message;
}
}
V2.php ##
<?php
class Mycompany_Mymodule_Model_Folder_Api_V2 extends Mycompany_Mymodule_Model_Folder_Api
{
}
Note - Also tried including helper folder and Data.php file and referring in config.xml but still not luck.
Can someone please check what I am missing here....
Let me know if any more information is needed.
Thanks Siddharth