Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error WSDL: SOAP-ERROR: Parsing WSDL: Couldn't load from

Tags:

soap

magento

My problem is very common. I read almost all topics on stackoverflow about this issue, but still can not do thing work. My code is :

ini_set("soap.wsdl_cache", "0");
ini_set("soap.wsdl_cache_enabled", "0");
$proxy = new SoapClient('http://Myhostname/api/soap?wsdl');

I had this error :

Error WSDL: SOAP-ERROR: Parsing WSDL: Couldn't load from 
'http://Myhostname/api/soap?wsdl' : failed to load external entity 
"http://Myhostname/api/soap?wsdl"

In the browser the URL

http://Myhostname/api/soap?wsdl

works great (returns an xml response)

I try this code to see if PHP can reach this URL :

if (file_get_contents('http://Myhostname/api/soap?wsdl') === false) {
    echo "ERROR: file_get_contents <br/>";
}

It displays me my error "ERROR: file_get_contents", so it does not work. On the forums I saw that to solve this problem I must add hostname into OS "hosts" file. So I did it. In my hosts file I added this line 127.0.0.1 Myhostname

But it still does not work. Then I changed URL in my code to

http://localhost/Myhostname/api/soap?wsdl

but it does not work either.

I tried another solution I found on the internet. For some people it worked. In my URL I changed '?' character to '.'. So my new URL became

http://localhost/Myhostname/api/soap.wsdl

but it does not work either.

I saw official SOAP doc! And tried to create SoapClient object in different way (with options like 'proxy_host' and 'proxy_port'). But this did not help me.

It's my second day I try to solve this problem, but I can not. I am doing my internship, I do not have a lot of experience, so maybe I did not try solutions I found correctly. Maybe someone can help. I would be very pleased.

like image 267
Kalitine Avatar asked Apr 12 '13 02:04

Kalitine


1 Answers

Few steps to check

Have a ping to Myhostname. It would give the ip. Use ip instead and see

Check if the services are enabled S0AP, php_openssl, openssl, curl

Hope you would get it :)

like image 169
Sandeep Avatar answered Sep 29 '22 16:09

Sandeep