SOAP-ERROR: Parsing WSDL: Couldn't load from local file - soap

I have a WSDL file which located in my server, I use this file a lot with SoapClient
$client = new \SoapClient(dirname(__FILE__) . DIRECTORY_SEPARATOR . self::$url, array(
'connection_timeout' => 180,
'verifypeer' => false,
'verifyhost' => false,
'soap_version' => SOAP_1_2,
'stream_context' => stream_context_create(['ssl' => [
'verify_peer' => FALSE,
'verify_peer_name' => FALSE,
'allow_self_signed' => TRUE
]])
));
It works as expected but sometimes it still giving me this error
SOAP-ERROR: Parsing WSDL: Couldn't load from '/var/www/public_html/laravel/app/Classes/orders_internal.wsdl' : failed to load external entity "/var/www/public_html/laravel/app/Classes/orders_internal.wsdl"
And it doesn't get back to work until I reboot the server!
Do you have any idea what am I missing?
Regards

I was having this issue too. I have a flow where I have to make 5 different calls to a soap api (in the same execution).
Only the last call was giving the error:
SOAP-ERROR: Parsing WSDL: Couldn't load from /var/www/html/SomFile.wsdl failed to load external entity.
I realized that just before the last call it was a logic to disable load external entities:
libxml_disable_entity_loader(true);
Make sure there is no logic disabling the ability to load external entities in some part of the code.
It is important to notice that libxml_disable_entity_loader() will be deprecated:
Warning
This function has been DEPRECATED as of PHP 8.0.0. Relying on this function is highly discouraged.

Related

Circular reference detected on TYPO3 11 backend login page

I have a weird error when trying to call the TYPO3 11 backend login page.
I updated from TYPO3 10 and can't login anymore.
I already removed all of my custom extensions, but the error persists and I can't make out where it comes from or why.
It seems to crash when reaching the first f:form.hidden field of the default login Fluid template.
As this is an obvious issue that probably would have got caught by core devs, I am pretty sure that this is correlated to a configuration of my instance, but as I said, this is to weird of an issue for me and I have no idea where to dig for the issue.
This is error message:
I can provide the whole stacktrace if needed.
Did you update your .htaccess file with the new rules for the TYPO3 backend? You can find a sample file in the the Resources folder of install tool extension: typo3/sysext/install/Resources/Private/FolderStructureTemplateFiles/root-htaccess
And I assume that you cleared all caches in the install tool and did a composer dump-autoload.
I discovered the source of this issue.
I had the following configuration automatically generated in my LocalConfiguration.php.
'SC_OPTIONS' => [
'GLOBAL' => [
'softRefParser' => [
'email' => 'TYPO3\\CMS\\Core\\Database\\SoftReferenceIndex',
'ext_fileref' => 'TYPO3\\CMS\\Core\\Database\\SoftReferenceIndex',
'notify' => 'TYPO3\\CMS\\Core\\Database\\SoftReferenceIndex',
'substitute' => 'TYPO3\\CMS\\Core\\Database\\SoftReferenceIndex',
'typolink' => 'TYPO3\\CMS\\Core\\Database\\SoftReferenceIndex',
'typolink_tag' => 'TYPO3\\CMS\\Core\\Database\\SoftReferenceIndex',
'url' => 'TYPO3\\CMS\\Core\\Database\\SoftReferenceIndex',
],
],
...
This caused the above error message. After removing this part from my configuration, the system lets me login and works flawlessly.

Type error: Argument 1 passed to Jenssegers\Mongodb\Query\Builder::__construct() must be an instance of Jenssegers\Mongodb\Connection

An application which is written in Laravel using mondodb as backend where "jenssegers/laravel-mongodb" vendor used as interface. Post loading application in browser throws following error :
Type error: Argument 1 passed to
Jenssegers\Mongodb\Query\Builder::__construct() must be an instance of
Jenssegers\Mongodb\Connection, instance of
Illuminate\Database\MySqlConnection given
Solution which helped me :
In .env file which overrides the config files.
it had DB_CONNECTION=mysql.
Changing it to following, fixed this bug.
DB_CONNECTION=mongodb
Work of caution :
Please ensure to provide correct value based on your server setup for following .env variable, I've kept it as default.
DB_CONNECTION=mongodb
DB_HOST=127.0.0.1
DB_PORT=27017
DB_DATABASE=
DB_USERNAME=
DB_PASSWORD=
if using two database connection together and have this problem with passport
modify setting in this Path:
vendor/laravel/passport/config/passport.php
and then change this lines:
'storage' => [
'database' => [
'connection' => env('DB_CONNECTION', 'yourdb'),
],
],

Why I get 500 Error while on XAMPP while loading CodeIgniter 3 database library?

I have gone through number of threads on stackoverflow and on other forums to find the answer but could not find relevant answer. People have applied different approaches but none has worked for me thus far.
I am using CI 3 on XAMPP and whenever I load database library in the model, I run into 500 Error.
Here is my CI database config info:
'hostname' => 'localhost',
'username' => 'my_user',
'password' => 'my_pass',
'database' => 'prod_db',
'dbdriver' => 'mysqli',
'dbprefix' => '',
'pconnect' => FALSE,
PHP ini db libraries are as below:
extension=php_bz2.dll
extension=php_curl.dll
extension=php_fileinfo.dll
;extension=php_ftp.dll
extension=php_gd2.dll
extension=php_gettext.dll
;extension=php_gmp.dll
;extension=php_intl.dll
;extension=php_imap.dll
;extension=php_interbase.dll
;extension=php_ldap.dll
extension=php_mbstring.dll
extension=php_exif.dll ; Must be after mbstring as it depends on it
extension=php_mysqli.dll
;extension=php_oci8_12c.dll ; Use with Oracle Database 12c Instant Client
;extension=php_openssl.dll
;extension=php_pdo_firebird.dll
extension=php_pdo_mysql.dll
;extension=php_pdo_oci.dll
;extension=php_pdo_odbc.dll
;extension=php_pdo_pgsql.dll
extension=php_pdo_sqlite.dll
;extension=php_pgsql.dll
;extension=php_shmop.dll
; The MIBS data available in the PHP distribution must be installed.
; See http://www.php.net/manual/en/snmp.installation.php
;extension=php_snmp.dll
My model code is as below:
class loginmodel extends CI_Model {
public function validate_login($username, $password) {
$this->load->database();
$var = 0;
return $var;
}
}
Whenever I remove $this->load->database(); from the model, my code runs and i am able to redirect to a "Login Failed" page. BUT, whenever I load my database library in autoload.php or load it in above model, code fails.
Autoload.php
$autoload['libraries'] = array('database');
Apache error logs showed below errors but I could not figure as why this was happening.
PHP Warning: PHP Startup: Unable to load dynamic library 'C:\\php\\ext\\php_mysqli.dll' - The specified module could not be found.\r\n in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library 'C:\\php\\ext\\php_pdo_mysql.dll' - The specified module could not be found.\r\n in Unknown on line 0
Please advise.
EDIT:
I verified all config to be OK and as stated in the comments, I added environment variables to windows and verified through PHPInfo that mysqli and mysqlnd were loaded.
Despite getting all the config right, error still persisted and I did a clean install of CI to reproduce library load failure. This time CI returned an error that db access was denied.
I then realized that after migration, database user was not created in the new environment. So once I created the desired user and assigned it required privileges, I was able to run the code just fine.
Therefore, if anyone encounters such issue in future, below steps might help:
First and foremost, verify if your desired user can access the
database.
Modify your .htaccess to use your desired URL schemes only after
verifying that database connection is working
Then verify that absolute path is available in PHP.ini on XAMPP.
Plus, verify that PHP is added in the environment variables. My
Values on Windows 10 are as follows: Variable Name: PHP , Variable
Value: C:\xampp\php\ext
In CI, mysqli is selected as database driver
In PHP.ini mysqli extension is enabled. i.e. php_mysqli.dll
Echo PHPInfo to verify that mysqli and mysqlnd are available in your
installation.
If nothing works, do a clean install of CI on a separate directory and load database library after setting up your database configuration and before setting up .htaccess until you can reproduce the error.
Hope that error will be eliminated!

Another facebook Fatal error: Uncaught CurlException

I am using latest base_facebook.php https://github.com/facebook/facebook-php-sdk/blob/master/src/base_facebook.php in order to authenticate the user to my web application via facebook.
Everything was working fine until today. I am getting suddenly a message in my web application like this
Fatal error: Uncaught CurlException: 7: Failed to connect to
2a03:2880:10:6f01:face:b00c:0:8: Network is unreachable thrown in
/var/www/pygmaxia2.gr/templates/pygmaxia2gr/base_facebook.php on line
977
Yesterday I was working normally and today all day long with no problem. The problem seemed to apear when I deleted a folder that I didn't need and was totally irrelevant with the file. When I do ctrl F5 for refresh with firefox, the message disappears and everything seems to work. But after a while It appears again just by clicking around in the page.
I have seen many have this problem but in my case there is no solution yet. The problem appears and disappears by itself without something visible causing it. I also need to mention that I am on a ubuntu 12.04 system and today I did an update. Do you think that it would disrupt the ipv6 related files? But still why is it going away periodically and then reappearing again? Also there is no firewall in my System.
Thank you
It seems that Facebook is down now in several country for more than an hour.... Just wait !
I'm having the exact same problem at the very moment, and it seems to me I can't connect to developers.facebook.com altogether.
Set Proxy To Connect Facebook.com
## Find Code In base_facebook.php ##
public static $CURL_OPTS = array(
CURLOPT_CONNECTTIMEOUT => 10,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 60,
CURLOPT_USERAGENT => 'facebook-php-3.2',
);
And Add option
public static $CURL_OPTS = array(
CURLOPT_CONNECTTIMEOUT => 10,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 60,
CURLOPT_USERAGENT => 'facebook-php-3.2',
CURLOPT_PROXY => '199.200.120.140:8089',
);
I encountered a similar curl exception since it was attempting to use IPv6 but was unable to.
Could get it working after I forced curl to use IPv4 via curl_setopt(). Followed the suggestion in this link - http://www.tech-and-dev.com/2012/07/how-to-fix-facebook-connect-error.html

resolve SoapFault exception: [HTTP] Unable to parse URL

I work on a projet which use a Soap based webservice queried by PHP and 2 native smartphone apps (ios and android) , after some edits made by the webservice development team, things were broken on PHP side but no problems from smartphone apps.
here is a simple script to reproduce the problem
<?php
error_reporting(E_ALL);
$url = 'http://www.xxxxx.com/service.awws?wsdl';
$sKey = 'thekey';
$client= new SoapClient($url, array('trace' => 1,
'exception' => 1,
'encoding' => 'UTF-8',
'cache_wsdl' => WSDL_CACHE_NONE));
$params = array('sKey' => $sKey, 'nLangID' => 1);
$res = $client->TPGetLocalisationVersion($params);
echo '<pre>Res : ';
print_r($res);
echo '</pre>';
?>
I get the following error:
Fatal error: Uncaught SoapFault exception:
[HTTP] Unable to parse URL in /home/xxxx/www/test.php:14 Stack trace: #0 [internal function]:
SoapClient->__doRequest('__call('TPGetLocalisati...', Array) #2 /home/tmpweb/www/test.php(14):
SoapClient->TPGetLocalisationVersion(Array) #3 {main} thrown in /home/xxxx/www/test.php on line 14
the method TPGetLocalisationVersion exists and the parameters are correct.
this code used to work some days ago.
I can also fetch the wsdl from the PHP Webserver using wget.
I tested the WSDL file with some online tool and it seems ok.
Any suggestions to debug this? I m sure the WSDL is not cached as I m on a dedicated server and completly disabled WSDL cache in php.ini
problem solved , the problem was in the soap:adress inside the WSDL (bad value)