andreaskoch / dockerized-magento

A dockerized Magento Community Edition 1.9.x
BSD 3-Clause "New" or "Revised" License
279 stars 144 forks source link

failed to load external entity "http://dockerized-magento.local/api.php?type=v2_soap&wsdl=1" #57

Open tothpaul opened 4 years ago

tothpaul commented 4 years ago

Hello,

nice Docker, easy to install, but the SOAP API fails at http://dockerized-magento.local/api/v2_soap/index

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Body>
<SOAP-ENV:Fault>
<faultcode>WSDL</faultcode>
<faultstring>SOAP-ERROR: Parsing WSDL: Couldn't load from 'http://dockerized-magento.local/api.php?type=v2_soap&wsdl=1' : failed to load external entity "http://dockerized-magento.local/api.php?type=v2_soap&wsdl=1" </faultstring>
</SOAP-ENV:Fault>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

it seem's that de image could not resolve dockerized-magento.local (the WSDL refer to the server itself)

I've tried to enter php to add 127.0.0.1 in /etc/hosts but it doesn't fix the problem.

any idea ?

tothpaul commented 4 years ago

found a workaround by adding

  extra_hosts:
   - "dockerized-magento.local:172.17.0.9"

in the PHP: section of docker-compose.yml

but I'm not sure that the IP will be always the same.

BTW I've used a PHP script to understand what to do

<?php
  readfile('/etc/hosts');
  echo gethostbyname('dockerized-magento.local');
  print_r($_SERVER); // to known the server's IP