Search code examples
phpsoapwsdltimeout

SOAP Request over https fails everytime


my first time doing a SOAP Request fails and fails again. I have to send some Data via SOAP but i dont get a stable connection.

I use the SOAP Extension of PHP. My Code looks like the following.

$certificate = file_get_contents(DATA_PATH.'/modules/va/misc/CKTC.cer');
$options = array(
                'uri'               => 'https://data2.kroschke.net/service/MeinAutoUeberfuehrungen',
                'allow_self_signed' => true,
                'verify_peer'       => true,
                'local_cert'        => $certificate,
                'trace'             => 1,
                'exceptions'        => true,
            );
$wsdl = 'https://data2.kroschke.net/service/MeinAutoUeberfuehrungen?WSDL';

$SOAPClient = new SoapClient($wsdl, $options);

fb($SOAPClient->__getFunctions());

Now my Problem is, that the SOAP Request always runs into a timeout.

I checked my php settings and SOAP and OpenSSL are activated.

I also tried it with a .pem instead of a .cer File. Same Problem.

This is what i get all the time: Warning: SoapClient::SoapClient(https://data2.kroschke.net/service/MeinAutoUeberfuehrungen?WSDL): failed to open stream: Connection timed out in

Anyone who can help?

PS: Dont mind the fb() Function. Just a function to print everything into FireBug.


Solution

  • just try to open https://data2.kroschke.net or https://data2.kroschke.net/service/MeinAutoUeberfuehrungen?WSDL in you browser: you'll get a timeout, too.

    the best solution would be to get in contact with the provider of that soap-server (kroschke.com/kroschke.de ?) and ask them why their server is down or seems to hang.

    EDIT:
    this doesn't seem to be the problem, so your only option is to set the timeout to a higher value. for this, just add connection_timeout (value in seconds) to your options:

    $options = array(
                'uri'               => 'https://data2.kroschke.net/service/MeinAutoUeberfuehrungen',
                'allow_self_signed' => true,
                'verify_peer'       => true,
                'local_cert'        => $certificate,
                'trace'             => 1,
                'exceptions'        => true,
                'connection_timeout'=> 30
            );
    

    if it still times out, set the value even higher - if it still times out then, try to test the soap-communication with a program like soapUI before implementing it with PHP - if you get problems with soapUI, too, contact the provider of that soap-server and ask why their methods take such a long time.

    for more information, take a look at the soapclient and it's options.