I have created Api in my module, when I accessing through coding it is working fine, but in url (wsdl format) & web services list (Back-End) are not showing. If I give my custom Api to others, it should be in web services list because we will provide permissions for that. So, how can I configure the custom api in wsdl & web service list?
my code is:
local->Course->Mca->etc->api.xml
<?xml version="1.0"?>
<config>
<api>
<resources>
<mca translate="title" module="mca">
<model>mca/api</model>
<title>MCA Student Resources</title>
<methods>
<create translate="title" module="mca">
</create>
</methods>
<faults module="mca"><!-- module="mca" specifies the module which will be used for translation. -->
<data_invalid> <!-- if we get invalid input data for customers -->
<code>100</code >
<!-- we cannot know all the errors that can appear, their details can be found in error message for call -->
<message>Invalid Student data. Details in error message.</message>
</data_invalid>
</faults>
</mca>
</resources>
</api>
</config>
local->Course->Mca->Model->Api.php
<?php
class Course_Mca_Model_Api extends Mage_Api_Model_Resource_Abstract
{
public function create($stuData)
{
return $stuData . ' My Custom Student Message';
}
public function info($stuId)
{
}
public function items($filters)
{
}
public function update($stuId, $stuData)
{
}
public function delete($stuId)
{
}
}
thanks in advance.
2 Answers 2
To allow access to your api via the roles section on the of the "web services" section you will need to update your code to include the <acl> node in-between api and resources.
<?xml version="1.0"?>
<config>
<api>
<acl>
<resources>
<mca translate="title" module="mca">
<model>mca/api</model>
<title>MCA Student Resources</title>
<methods>
<create translate="title" module="mca">
</create>
</methods>
<faults module="mca"><!-- module="mca" specifies the module which will be used for translation. -->
<data_invalid> <!-- if we get invalid input data for customers -->
<code>100</code >
<!-- we cannot know all the errors that can appear, their details can be found in error message for call -->
<message>Invalid Student data. Details in error message.</message>
</data_invalid>
</faults>
</mca>
</resources>
</acl>
</api>
</config>
-
I have updated my code, but it is not showing in web service list & wsdl(format).Manoj Kumar– Manoj Kumar2013年10月15日 12:34:01 +00:00Commented Oct 15, 2013 at 12:34
-
how do you get this list of web services? the above code will allow you to give this as a role under "SOAP/XML-RPC - Roles"David Manners– David Manners2013年10月15日 13:13:40 +00:00Commented Oct 15, 2013 at 13:13
Create a file calles app/code/local/Course/Mca/etc/wsdl.xml and compare its contents with one of those in core.
find app/code/core/Mage -iname 'wsdl.xml'
wsdl.xmlin your Moulesetcdirectory?