【问题标题】:Long Soap calls not getting returned value长肥皂调用没有得到返回值
【发布时间】:2012-09-11 09:22:30
【问题描述】:

感谢 php SoapClient 对象,我正在尝试调用 magento api 方法。

问题在于创建 magentos 产品的方法可能相对较长(最多 2 分钟)。我需要获取此方法的返回值,但一段时间后,soap 调用停止并返回 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) {
...
}

我真的需要得到被调用方法的返回值,不管它需要什么时间。

你知道为什么一段时间后调用返回 null 吗?

是否有可以配置的默认超时时间?

【问题讨论】:

标签: php magento soap soap-client


【解决方案1】:

感谢 Jürgen 的评论,这是一个解决方案:

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

这会将通话超时设置为 2 分钟

【讨论】:

    猜你喜欢
    • 2018-04-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-11-19
    • 1970-01-01
    • 2012-01-02
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多