0

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 ==

Bert Maurau
  • 979
  • 5
  • 21
  • $this -> buildWsdlUrl() maybe this returns incorrect path to wsdl on prod – buildok Jul 16 '18 at 09:34
  • Appreciate the fast reply. The buildWsdlUrl() returns the same WS-url based off a constant in my class. (the script and the variable config are identical for now for debugging purposes). The only difference is that my localhost is running from HTTP and the prod-server is running from HTTPS (but if that would cause the issue, I'd suspect it would be the opposite way around) – Bert Maurau Jul 16 '18 at 09:41

1 Answers1

0

Found the issue. Pretty obvious reason for this situation. Maybe if I'd posted the URL here, you guys would've pointed that out (stupid of me).

Aparently, our server has a top-level shared firewall via our provider and the port (where the remote webservice is running on, port 8002) was blocked for outgoing connections.

I've contacted our provider, they openend that port, and all runs perfectly now..

Bert Maurau
  • 979
  • 5
  • 21