Server is CENTOS with PHP 5.4 and Apache 2.2.
I have a SoapClient object like this:
$client = new \SoapClient(__DIR__ . "/wsdlfilehere.wsdl", array("soap_version"=>SOAP_1_2, "trace"=>true));
After awhile (within 24 hours), this code throws an error:
SOAP-ERROR: Parsing WSDL: Couldn't load from '/wsdlfilehere.wsdl' : failed to load external entity "/wsdlfilehere.wsdl".
Then after I restart apache and it works again.
Edit: even setting cache_wsdl to WSDL_CACHE_NONE doesn't fix the issue.
After digging around I finally found a workaround/solution.
Following this link on Ubuntu's launchpad it seems that other people are also experiencing this problem. I followed zabuch's instruction at comment #6 and it seems to work now. I agree with him that the issue might be on mod_php/php itself and not Ubuntu only, since I'm on CentOS and have experienced this problem.
From zabuch's comment:
The workaround for the issue is to add this:
libxml_disable_entity_loader(false);
before creating new SoapClient.
Related
I have few controllers in my zf2 project which work perfectly in the browser using apache and via command line.
However, I recently installed MongoDb so I can store some data using the driver found in (http://php.net/manual/en/set.mongodb.php)
My issue is, when I try to access the driver via controller + browser, I get the following message error in my apache logs :
PHP Fatal error: Class 'MongoDb\Driver\Manager' not found.
'MongoDb\Driver\Manager' is the namespace for this Driver.
If I execute some other controllers via command line, MongoDb works correctly.
Does anyone know why is this happening? I cannot see the issue :(
Thank you
I found that my php.ini was pointing to mongo.so instead of mongodb.so
That fixed the issue
http://php.net/manual/en/mongodb.installation.manual.php
Thank you for your help
I recently updated my module to open cart 2.x from 1.5. I was using webservice in my module and it was working fine in 1.5 version. But when i updated to 2.x iam getting this error.
SOAP-ERROR: Parsing WSDL: Couldn't load from** 'https://abc.xyz.com/EndiciaParamWebService?wsdl' : **Start tag expected, '<' not found
I am calling my soap client like this.
$proxy = new SoapClient("http://hxlabelserver-heurixtics.rhcloud.com/EndiciaParamWebService?wsdl");
May be i am too late to answer this...but still add here so that someone can take help of it.
I also had this issue and i was left with two options:
1>openSSL was off
2>PHP version got mismatched
openssl was on for me...so then started playing with different version of php
And got it solved when reached php version 5.6
So i suggest you also can try with different version and could possibly match the good php version for your solution.
Recently, I installed lumen (5.0.4) mfw and ran into an issue with page load on default configuration. I have unpredictable behavior of page load process.
Sometimes it loads okay but sometimes instead of loading I am getting a download dialog with zero size unnamed file or it throws an exception like
NotFoundHttpException in Application.php line 1109:
(At first, I want to say that other non lumen/laravel sites work fine) Server configuration:
Apache 2.4.12
PHP 5.6.7-1
Zend Engine v2.6.0 with Zend OPcache v7.0.4-dev
I think the problem is with php working through php-fpm because with fcgi configuration it seems to work well.
I tried NotFoundHttpException with Lumen but that didn't help me.
I have same issue, after hours of research and debug, I fixed the issue.
If you are doing something like this ...
$app->run($httpRequest);
instead do ...
$httpRequest = Illuminate\Http\Request::capture();
$app->run($httpRequest);
Hope this is helpful. Thanks!
Change $app->run(); to $app->run($app['request']); in public/index.php (Lumen 5.2)
I am looking for help with this problem and I hope someone give me that help. The error is the following:
Fatal error: SOAP-ERROR: Parsing WSDL: Couldn't load from 'http://example.com/index.php/api/?wsdl' : failed to load external entity "http://example.com/index.php/api/?wsdl" in
/var/www/presentacion/app/code/local/Pengo/Extension/Model/Something.php on line 28
And the code that I'm using to connect to it is something like this:
$this->_soap = new SoapClient(http://example.com/index.php/api/?wsdl);
and there is where it says is the error.
I have been serching in Google, PHP forums, here in StackOverflow and Magento itself but I don't find the solution anywhere.
What I had seen is that the WSDL is never get parsed or loaded as the error says and none of its functions.
I tried connecting like this:
$options['location'] = http://example.com/index.php/api/?wsdl;
$options['uri'] = 'urn:Magento';
$this->_soap = new SoapClient(null, $options);
like this it doesn't dispatch any error like the others but there aren't functions to use, like in the other case it doesnt' load and parse the WSDL.
I am a bit frustrated because I have been developing this like 1 month and now that I am making some tests it shows this message, I had test it when it was really empty and new and it worked fine.
So any help would be appreciated.
Thank you.
Nine times out of ten this error is Magento is telling you it can't load the WSDL file. Magento is telling you this. It's not your local client code that's complaining.
Magento uses the PHP SoapServer object to create its SOAP API. The SoapServer object needs to access the WSDL as well. Try running the following from your server's command line
curl http://example.com/index.php/api/?wsdl
If I'm right, the above will timeout/fail.
Because of some quirks in DNS, it's surprisingly common that a server won't be able to access itself via its domain name. If this is the case, the quickest fix is adding an entry to the server's hosts file. (Talk to your server admin if none of that made sense)
Well after all the things that I test the only one that worked for me, I don't know why but it worked, was doing this in two separate machines. I tried that because I read that somewhere and I just do it and my Magento and Webservice now works perfectly. Whenever I try to do this local it dispatch the same error.
I hope this can help someone in the future and they don't have to knock their head on the wall because of this problem.
Thank you all for your answers and comments.
Alan Storm is right on the Money here!
Make sure that you check your server Hosts File, and that it includes an entry for both domain and www.domain. Espicialy important if you are doing server rewrites.
When I try to use SoapClient:
try {
$client = new SoapClient('http://someurl/somefile.wsdl');
} catch (SoapFault $e) {
var_dump($e);
}
I have catch error with:
["faultstring"] => "SOAP-ERROR: Parsing WSDL: Couldn't load from 'http://someurl/somefile.wsdl' : failed to load external entity "http://someurl/somefile.wsdl"
["faultcode"] => "WSDL"
I can manually download http://someurl/somefile.wsdl and can file_get_contents for this file. I try to use it before on different computer and it worked. Possible problem with php or apache settings..
ArchLinux with last updates for php and apache. I tried to enable all php extensions.
Were you able to get wsdl using file_get_contents() in browser?
I had similar issue recently in Archlinux with same faultstring, no matter what wsdl file was used. The same code was working without any problem on other Archlinux machine and Windows XP box.
After some research, it came out that problem arose only when I tried to access the page in browser - script accessed from command line worked as expected. Then I changed the script to download the wsdl file directly, using aforementioned file_get_contents() - it gave me a warning "php_network_getaddresses: getaddrinfo failed: Name or service not known".
Few tutorials (on SO, or this one: http://albertech.net/2011/05/fix-php_network_getaddresses-getaddrinfo-failed-name-or-service-not-known/ ) later I haven't fought off the problem yet. But then I discovered what introduced the issues: I had been running NetworkManager since the installation of Arch (to better handle wireless), and few weeks later I've added mysqld and httpd as last to DAEMONS section in rc.conf - it seems this broke DNS resolution for apache.
Having two solutions (go back to starting servers manually or try other network manager) I've switched to wicd and haven't run into the issue again.