How to create custom api with multiple parameters passed in the api call file in magento1. I have added the code in request call. But it is not working.

Thanks in advance

wsdl.xml file

    <?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns:typens="urn:{{var wsdl.name}}" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
             xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
             name="{{var wsdl.name}}" targetNamespace="urn:{{var wsdl.name}}">
    <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="testPushNotificationCreateArray">
              <restriction base="soapenc:Array">
                  <attribute ref="soapenc:arrayType" wsdl:arrayType="typens:testPushNotificationCreate[]"/>
       <complexType name="testPushNotificationCreate">
          <element name="token" type="xsd:string" minOccurs="0"/>
          <element name="customer_group_id" type="xsd:string" minOccurs="0"/>
          <element name="channel" type="xsd:string" minOccurs="0"/>
  <message name="dzPushnotifTokenCreateRequest">
    <part name="sessionId" type="xsd:string"/>
    <part name="data" type="typens:testPushNotificationCreate"/>
  <message name="dzPushnotifTokenCreateResponse">
 <!--    <part name="result" type="typens:testPushNotificationCreateArray"/> -->
    <part name="result" type="xsd:int"/>
  <portType name="{{var wsdl.handler}}PortType">
     <operation name="dzPushnotifTokenCreate">
            <input message="typens:dzPushnotifTokenCreateRequest"/>
            <output message="typens:dzPushnotifTokenCreateResponse"/>
  <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="dzPushnotifTokenCreate">
            <soap:operation soapAction="urn:{{var wsdl.handler}}Action"/>
                <soap:body namespace="urn:{{var wsdl.name}}" use="encoded"
                <soap:body namespace="urn:{{var wsdl.name}}" use="encoded"
  <service name="{{var wsdl.name}}Service">
    <port name="{{var wsdl.handler}}Port" binding="typens:{{var wsdl.handler}}Binding">
      <soap:address location="{{var wsdl.url}}" />

1 Answer 1


The following link is a step by step link to create custom API in Magento1 with sample source code, a bit old though.



You may check the below code for the input parameters.

<message name="productsapiActiveListRequest">
<part name="sessionId" type="xsd:string"/>
<part name="websiteId" type="xsd:string" />

And you can check the testcall.php included in the zip file given a link at the bottom of the tutorial. The test file shows how to call the params in the API

  • Thanks. I have created a custom module and it is working. But not able to pass parameters in the api call.
    – user78358
    Apr 29, 2019 at 7:45
  • @user78358 Updated the answer.
    – Duke
    Apr 29, 2019 at 7:50
  • Thanks. Working fine only for single parameter. Not working for multiple parameters. Added the value inside the array. But it takes one value only. Any suggestions please?
    – user78358
    Apr 29, 2019 at 10:51
  • Did you happen to change the type while you passing the array as parameter? <part name="websiteId" type="xsd:string" />
    – Duke
    Apr 29, 2019 at 10:57
  • Yes I have changed to array parameter to type="typens:testPushNotificationCreate"
    – user78358
    Apr 29, 2019 at 11:30

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.