phpmagentosoapsoap-clientmagento-soap-api

Long Soap calls not getting returned value


I am trying to call a magento api method thanks to a php SoapClient object.

The problem is the method called creates magentos products and can be relatively long (up to 2 minutes). I need to get the returned values of this method but after a while, the soap call stops and return null.

$session_id = _get_session_id();
$client = new SoapClient($api_url . '&SID=' . $session_id, array('trace' => 1));

try {           
    $session = $client->login($api_user, $api_password);
    $result = $client->call($session, 'api_call.method', array($arg1, $arg2);
}
catch(SoapFault $soapFault) {
...
}

I really need to get the called method return value, whatever the time it takes.

Do you know why the call return null after a while?

Is there a default timeout that can be configured?


Solution

  • Here is a solution, thanks to Jürgen comment:

    ini_set('default_socket_timeout', 120); // 2 minutes
    

    This set the call timeout to 2 minutes long