php soapclient 异常,一个请求后,PHP SoapClient失败

我有一个使用SoapClient访问API的

PHP脚本.连接后,如果我只发出一个请求,它按预期工作,但当我尝试使用相同的SoapClient对象发出第二个请求时,我收到错误请求错误.

我相信这个问题可能与我的服务器配置有关,因为相同的PHP代码在另一台具有较旧版本PHP的计算机上工作正常但在我的测试和生产服务器上已更新到PHP 5.6都遇到此错误.

码:

class ReportAPI

{

protected $reportDataObject = null;

public function __construct($url = 'URL', $username = 'username', $password = 'pass') {

$this->client = new SoapClient($url , array('login' => $username, 'password' => $password, 'keep_alive' => true));

}

public function getReportData($reportID) {

return $this->getDataObject($reportID)->data;

}

public function getReportCount($reportID) {

return $this->getDataObject($reportID)->result_count;

}

public function runReport($reportID) {

$newID = $this->client->runReport($reportID);

$counter = 0;

while($this->client->checkReportRun($newID) != 'complete'){

if($counter > 2) {

throw new Exception('Report Time Out');

}

sleep(5);

$counter++;

}

$this->getDataObject($newID);

return $newID;

}

public function functest() {

$v0 = $this->getDataObject('id')->result_count;

return $this->getDataObject('id')->data;

}

public function getLatestID($reportID) {

$runlist = $this->client->getReportRunList($reportID);

return $runlist[0][0];

}

public function getLatestReportData($reportID) {

return $this->getReportData($this->getLatestID($reportID));

}

public function getTitles($reportID) {

return $this->getDataObject($reportID)->columns;

}

public function getReportRunTime($reportID) {

$runlist = $this->client->getReportRunList($reportID);

return strtotime($runlist[0][2]);

}

public function getRawReport($reportID) {

return $this->client->getReportDataObject($reportID);

}

protected function getDataObject($reportID) {

if(!isset($this->reportDataObject) || $this->reportDataObject->report_run_id != $reportID) {

$this->reportDataObject = $this->client->getReportDataObject($reportID);

}

return $this->reportDataObject;

}

}

?>

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值