0

I'm trying to get the WSDL services list on a local dev server, entering the url below in a browser as per the documentation at http://devdocs.magento.com/guides/v2.1/soap/bk-soap.html

http://mu2.dev/soap/default?wsdl_list=1

I get the error response below. Does anyone know why? I've tried various permutations of the url with no luck.

  <?xml version="1.0" encoding="UTF-8"?>
  <env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" xmlns:m="http%3A%2F%2Fmu2.dev%2Fsoap%2Fdefault%3Fwsdl%3D1">
     <env:Body>
        <env:Fault>
           <env:Code>
              <env:Value>env:Receiver</env:Value>
           </env:Code>
           <env:Reason>
              <env:Text xml:lang="en">Class &quot;array&quot; does not exist. Please note that namespace must be specified.</env:Text>
           </env:Reason>
           <env:Detail><m:GenericFault><m:Trace>&lt;![CDATA[#0 /Users/mstadler/src/mu2017/mu2/vendor/magento/framework/Reflection/TypeProcessor.php(229): Magento\Framework\Reflection\TypeProcessor-&gt;register('array')
  #1 /Users/mstadler/src/mu2017/mu2/vendor/magento/framework/Reflection/TypeProcessor.php(198): Magento\Framework\Reflection\TypeProcessor-&gt;_processMethod(Object(Zend\Code\Reflection\MethodReflection), 'CatalogDataCate...')
  #2 /Users/mstadler/src/mu2017/mu2/vendor/magento/framework/Reflection/TypeProcessor.php(162): Magento\Framework\Reflection\TypeProcessor-&gt;_processComplexType('\\Magento\\Catalo...')
  #3 /Users/mstadler/src/mu2017/mu2/vendor/magento/framework/Reflection/TypeProcessor.php(229): Magento\Framework\Reflection\TypeProcessor-&gt;register('\\Magento\\Catalo...')
  #4 /Users/mstadler/src/mu2017/mu2/vendor/magento/framework/Reflection/TypeProcessor.php(198): Magento\Framework\Reflection\TypeProcessor-&gt;_processMethod(Object(Zend\Code\Reflection\MethodReflection), 'CatalogDataCate...')
  #5 /Users/mstadler/src/mu2017/mu2/vendor/magento/framework/Reflection/TypeProcessor.php(162): Magento\Framework\Reflection\TypeProcessor-&gt;_processComplexType('Magento\\Catalog...')
  #6 /Users/mstadler/src/mu2017/mu2/vendor/magento/module-webapi/Model/Config/ClassReflector.php(91): Magento\Framework\Reflection\TypeProcessor-&gt;register('Magento\\Catalog...')
  #7 /Users/mstadler/src/mu2017/mu2/vendor/magento/module-webapi/Model/Config/ClassReflector.php(72): Magento\Webapi\Model\Config\ClassReflector-&gt;extractMethodData(Object(Zend\Code\Reflection\MethodReflection))
  #8 /Users/mstadler/src/mu2017/mu2/vendor/magento/module-webapi/Model/ServiceMetadata.php(119): Magento\Webapi\Model\Config\ClassReflector-&gt;reflectClassMethods('Magento\\Catalog...', Array)
  #9 /Users/mstadler/src/mu2017/mu2/vendor/magento/module-webapi/Model/ServiceMetadata.php(148): Magento\Webapi\Model\ServiceMetadata-&gt;initServicesMetadata()
  #10 /Users/mstadler/src/mu2017/mu2/vendor/magento/module-webapi/Model/AbstractSchemaGenerator.php(75): Magento\Webapi\Model\ServiceMetadata-&gt;getServicesConfig()
  #11 /Users/mstadler/src/mu2017/mu2/vendor/magento/module-webapi/Controller/Soap.php(137): Magento\Webapi\Model\AbstractSchemaGenerator-&gt;getListOfServices()
  #12 /Users/mstadler/src/mu2017/mu2/var/generation/Magento/Webapi/Controller/Soap/Interceptor.php(24): Magento\Webapi\Controller\Soap-&gt;dispatch(Object(Magento\Framework\App\Request\Http))
  #13 /Users/mstadler/src/mu2017/mu2/vendor/magento/framework/App/Http.php(135): Magento\Webapi\Controller\Soap\Interceptor-&gt;dispatch(Object(Magento\Framework\App\Request\Http))
  #14 /Users/mstadler/src/mu2017/mu2/vendor/magento/framework/App/Bootstrap.php(258): Magento\Framework\App\Http-&gt;launch()
  #15 /Users/mstadler/src/mu2017/mu2/index.php(39): Magento\Framework\App\Bootstrap-&gt;run(Object(Magento\Framework\App\Http))
  #16 {main}]]&gt;</m:Trace></m:GenericFault></env:Detail>
        </env:Fault>
     </env:Body>
  </env:Envelope>

I've tracked down the error conditions. It is caused by the magento U training module \Training\Category. When the ExtensionInterface class Magento\Catalog\Api\Data\CategoryExtensionInterface is generated the getCountries() method's annotation looks like this:

/**
 * @return array|null
 */
public function getCountries();

It should look like this:

/**
 * @return string[]|null
 */
public function getCountries();

Does anyone know how to get DI to generate this correctly?

0

Solved it, and it was actually really obvious (facepalm). The type is in the extension_attributes.xml.

Training/Cataegory/etc/extension_attributes.xml was this:

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Api/etc/extension_attributes.xsd">
    <extension_attributes for="Magento\Catalog\Api\Data\CategoryInterface">
        <attribute code="countries" type="array" />
    </extension_attributes>
</config>

It should have been this:

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Api/etc/extension_attributes.xsd">
    <extension_attributes for="Magento\Catalog\Api\Data\CategoryInterface">
        <attribute code="countries" type="string[]" />
    </extension_attributes>
</config>

Your Answer

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

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