2016-02-01 58 views
0

我有一个处理基于SOAP的Web服务的函数。无法使用CRON从SOAP Web服务接收xml响应

当我通过URL运行函数时,我得到了XML响应。但是当我通过CRON运行该函数时,我没有得到xml响应。

<?php 

$logFile = 'checking'.date('Y-m-d').'.log'; 

     $client = new SoapClient("http://DOMAIN/services/weburl?wsdl",array("trace" => true, 'use' => SOAP_LITERAL)); 
     $params = array('username' => 'username', 'Password' => 'password', 'delatdate' => '17/06/2015 18:00:00'); 
     try{ 
      $response = $client>-productOnHand($params); 


     } catch(SoapFault $e){ 
      echo $e->faultcode; echo '<br />'; 
      echo $e->getMessage(); echo '<br />'; 
     } 

     require_once 'app/Mage.php'; 
     Mage::app(); 

     Mage::log(print_r($response, true), null, $logFile); 
     Mage::log(print_r($client->__getLastResponse(), true), null, $logFile); 

?> 

如果我通过URL运行此网页,我得到有效的XML响应。但是当通过CRON调用这个页面时,我没有得到有效的回应。

+0

当你从cron运行它时,你会得到什么?有没有错误? –

+0

@AlexBlex我没有收到任何错误。同时我没有得到任何回应。但如果我通过浏览器运行,我得到了一些像'stdClass Object ( [return] =><?xml version =“1.0”encoding =“UTF-8”?><产品......' – Butterfly

+0

如果你没有错误,也没有回应,你怎么知道你的cron作业开始了? –

回答

0

我修复了这个问题。

之前default_socket_timeout被设置为60.我把它提升为600.现在我能够接收了。