0

I have a custom table and I want to send its data on another platform through soap Api. I tried to modify a module but when I change fields of wsdl.xml and add more index of array in Api.php its not showing those here is my code

class MyCompany_MyModule_Model_Api extends Mage_Api_Model_Resource_Abstract {
public function my_method_name(){
    return array(
        array('my_int' => 7, 'my_string' => 'lorem ipsum', 'ao_int' => 7,'a_int'=>2 ),
        array('my_int' => 9, 'my_string' => 'dot sit amet','ao_int' => 7,'a_int'=>2 ),
    );
}

}

and wsdl.xml code is here

<?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}}" xmlns:ns0="urn:Magento">
    <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/" />
            <complexType name="apiprefix_myDataEntity">
                <all>
                    <element name="my_int" type="xsd:int" minOccurs="0" />
                    <element name="my_string" type="xsd:string" minOccurs="0" />
                    <element name="ao_int" type="xsd:int" minOccurs="0" />
                    <element name="a_int" type="xsd:int" minOccurs="0" />

                </all>
            </complexType>
            <complexType name="apiprefix_myDataEntityArray">
                <complexContent>
                    <restriction base="soapenc:Array">
                        <attribute ref="soapenc:arrayType" wsdl:arrayType="typens:apiprefix_myDataEntity[]" />
                    </restriction>
                </complexContent>
            </complexType>
        </schema>
    </types>

    <message name="apiprefix_myresourceMyfunctionRequest">
        <part name="sessionId" type="xsd:string" />
    </message>
    <message name="apiprefix_myresourceMyfunctionResponse">
        <part name="result" type="typens:apiprefix_myDataEntityArray" />
    </message>

    <portType name="{{var wsdl.handler}}PortType">
        <operation name="apiprefix_myresourceMyfunction">
            <documentation>Do stuff</documentation>
            <input message="typens:apiprefix_myresourceMyfunctionRequest" />
            <output message="typens:apiprefix_myresourceMyfunctionResponse" />
        </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="apiprefix_myresourceMyfunction">
            <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>

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.