0

Actually I creaed custom module helloworld. I created all specified files as specified in documentation of magento.But where the problem is encounter, Actullly my code is as follows. Plz I am new to this domain can any body help where I did the wrong I need to publish the custom webservice method but iam not getting this module name in the list to give role to user.

Test enter image description here

Test is Package name and my indexController.php code is

<?php
class Test_Helloworld_IndexController extends Mage_Core_Controller_Front_Action
{
    /*     * this method privides default action.     */
    public function indexAction()
    {        /*         * Initialization of Mage_Core_Model_Layout model         */
        echo 'Hi this is Custom Module' . '</br>';
        /*/*         * Initialization of Mage_Core_Model_Layout model         */
       // $this->loadLayout();         /*         * Building page according to layout confuration         */
        //$this->renderLayout();
    }
}
?>

ANd my Adminhtml.xml code is

<?xml version="1.0"?>
<config>
    <adminhtml>
        <menu>
            <helloworld_mod translate="title" module="helloworld">
                <title>Store Hello World Module Section</title>
            </helloworld_mod>
        </menu>

        <acl>
            <resources>
                <admin>
                    <children>
                        <helloworld_mod translate="title" module="helloworld">
                            <title>Store Hello World Module Section</title>
                        </helloworld_mod>
                    </children>
                </admin>
            </resources>
        </acl>
    </adminhtml>
 </config>

and my api.xml code is

<?xml version="1.0"?>
<config>
    <api>
        <resources>
            <acl>
                <helloworld_category translate="title" module="helloworld">
                    <model>helloworld/category_api</model>
                    <methods>
                        <hello translate="title" module="helloworld">
                        </hello>
                    </methods>
                    <faults>
                        <data_invalid>
                            <code> 100 </code>
                            <message>Invalid data</message>
                        </data_invalid>
                    </faults>
                </helloworld_category>
            </acl>
        </resources>
        <V2>
            <resources_function_prefix>
                <helloworld> hello</helloworld>
            </resources_function_prefix>
        </V2>

        <resources_alias>
            <helloworld>helloworld_category</helloworld>
        </resources_alias>

    </api>
</config>

and my cofig.xml code is

<?xml version="1.0"?>
<config>
    <modules>
        <test_helloworld>
            <version>0.1.0</version>
        </test_helloworld>
    </modules>
    <frontend>
        <routers>

            <helloworld>

                <use>standard</use>

                <args>

                    <module>test_helloworld</module>

                    <frontName>helloworld</frontName>

                </args>

            </helloworld>

        </routers>
    </frontend>
    <global>

         <helpers>
            <helloworld>
                <class>test_telloworld_Helper</class>
            </helloworld>
        </helpers>

        <adminhtml>
            <!--<menu>
                <Helloworld translate="title" module="Helloworld">
                    <title>Blacklist</title>
                    <sort_order>71</sort_order>
                    <children>
                        <items translate="title" module="blacklist">
                            <title>Manage Items</title>
                            <sort_order>0</sort_order>
                            <action>blacklist/adminhtml_blacklist</action>
                        </items>
                    </children>
                </Helloworld>
            </menu>-->

            <acl>
                <resources>
                    <admin>
                        <children>

                            <helloworld>
                                <title>Store Hello World Module Section</title>
                            </helloworld>

                        </children>
                    </admin>
                </resources>
            </acl>
        </adminhtml>

    </global>
</config>

and my system.xml code is

<?xml version="1.0"?>
<config>
    <tabs>
        <helloconfig translate="label" module="Helloworld">
            <label>Hello Config</label>
            <sort_order>99999</sort_order>
        </helloconfig>
    </tabs>
    <sections>
        <helloworld_options translate="label" module="Helloworld">
            <label>Hello World Config Options</label>
            <tab>helloconfig</tab>
            <frontend_type>text</frontend_type>
            <sort_order>1000</sort_order>
            <show_in_default>1</show_in_default>
            <show_in_website>1</show_in_website>
            <show_in_store>1</show_in_store>
        </helloworld_options>
    </sections>
</config>

and wsdl.xm code is

<?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="helloRequest">
        <part name="sessionId" type="xsd:string" />
        <part name="msg" type="xsd:string" />
    </message>
    <message name="helloResponse">
        <part name="result" type="xsd:string" />
    </message>
    <portType name="{{var wsdl.handler}}PortType">
        <operation name="hello">
            <documentation>HelloWorld msg</documentation>
            <input message="typens:helloRequest" />
            <output message="typens:helloResponse" />
        </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="hello">
            <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>
</definitions>

And my Data.php code is

<?php
class Test_Helloworld_Helper_Data extends Mage_Core_Helper_Abstract
{
}

And my V2.php code is

<?php
class Test_Helloworld_Model_category_Api_V2 extends Test_Helloworld_Model_category_Api
{
}

And my Api.php code is

<?php
class Test_Helloworld_Model_category_Api extends Mage_Api_Model_Resource_Abstract
{

    public function hello($sessionId,$msg)
    {
        $result = 'this is from custom module'.$msg ;
        return $result;
    }
}

Pease I am new to this domain can any body help where I did the wrong I need to publish the custom webservice method but I am not getting this module name in the list to give role to user.

1 Answer 1

1

To get the information appearing in the webserives section you will need to make the following changes.

  1. Move the switch the acl and resources nodes it should be acl->resources,
  2. Add a title node inside the helloworld_category section,

The file should looks as follows.

<?xml version="1.0"?>
<config>
    <api>
        <acl>
            <resources>
                <helloworld_category translate="title" module="helloworld">
                    <title>Hello World</title>
                    <model>helloworld/category_api</model>
                    <methods>
                        <hello translate="title" module="helloworld">
                        </hello>
                    </methods>
                    <faults>
                        <data_invalid>
                            <code> 100 </code>
                            <message>Invalid data</message>
                        </data_invalid>
                    </faults>
                </helloworld_category>
            </resources>
        </acl>
        <V2>
            <resources_function_prefix>
                <helloworld> hello</helloworld>
            </resources_function_prefix>
        </V2>

        <resources_alias>
            <helloworld>helloworld_category</helloworld>
        </resources_alias>
    </api>
</config>

One final comment is to be careful with the cases in magento I notice that your controllers directory starts uppercase where it should be lowercase. Also in your system.xml you are using module="Helloworld" where it should be lowercase.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.