I'm having this issue where my integration script, that executes SoapClient requests, works on my local dev-machine, but returns
'failed to load external entity'
on our prod-server after a time-out. (Via the browser works as well)
Simplified code..
$contextOptions = array(
'ssl' => array(
'verify_peer' => false,
'verify_peer_name' => false,
'allow_self_signed' => true,
'ciphers' => 'RC4-SHA',
));
$sslContext = stream_context_create($contextOptions);
// initiate the SoapClient
$options = [
// 'soap_version' => self::SOAP_VERSION,
// 'connection_timeout' => self::SOAP_CONNECTION_TIMEOUT,
'login' => $this -> getTenant() . '\\' . $this -> getUsername(),
'password' => $this -> getPassword(),
// 'features' => SOAP_SINGLE_ELEMENT_ARRAYS,
// 'encoding' => 'UTF-8',
'verifypeer' => false,
'verifyhost' => false,
// 'soap_version' => SOAP_1_2,
'trace' => 1,
'exceptions' => 1,
'connection_timeout' => 60,
'cache_wsdl' => WSDL_CACHE_NONE,
'stream_context' => $sslContext
];
$this -> soapClient = new \SoapClient($this -> buildWsdlUrl(), $options);
And the actual request
$result = $this -> soapClient -> ImportGenJournalLines($ImportGenJournalLines -> getRequest());
The configuration on both machines.
> Soap Client enabled
> Soap Server enabled
>
> soap.wsdl_cache 1 1
> soap.wsdl_cache_dir /tmp /tmp
> soap.wsdl_cache_enabled 1 1
> soap.wsdl_cache_limit 5 5
> soap.wsdl_cache_ttl 86400 86400
>
> Registered PHP Streams php, file, glob, data, http, ftp, zip, compress.zlib, compress.bzip2, https, ftps, phar
The only difference between servers is that the localhost runs on an Apache 2.0 Handler, while the prod-server runs on FPM/FastCGI as the Server API.
I've tried with different PHP versions (just in case that something could be different) like 5.6, 7.1 and 7.2. The localhost works perfectly on all versions, but the prod-server throws a timeout.
The remote webservice is a Microsoft Dynamics server.
Basic SOAP-calls (for other integrations) are working without issues.
At first, I thought it was due to caching, but then I've added a cache-buster and changed the php config, but no results there.
What configuration should I check next? Our server is generally "open" (no restrictions, up-to-date with packages, purely used for webscripts), but aparently I'm missing a key-element that is causing this.
== Update ==
I've also tried to send the following with my context options, but no success:
'http' => array(
'user_agent' => 'PHPSoapClient'
)
Found via: SOAP-ERROR: Parsing WSDL: Couldn't load from - but works on WAMP
== Answered my own question at the bottom ==