doulin2025 2018-11-13 17:08
浏览 216
已采纳

如何在PHP中为SOAP客户端正确设置Cookie / Header?

I am trying to enable xDebug support for a SOAP call following several topics I have found out there (see list at the end of this post) and this is what I have done so far:

$this->_client_soap = new SoapClient(
    $this->ecase_wsdl,
    array(
        'trace'        => 1,
        'exceptions'   => true,
        'soap_version' => SOAP_1_1,
        'cache_wsdl'   => WSDL_CACHE_NONE
    )
);

// Xdebug Support
$xdebug_remote_address = $this->CI->config->item('xdebug_remote_address');
$xdebug_cookie         = $this->CI->config->item('xdebug_cookie');

if ($xdebug_remote_address && $xdebug_cookie) {
    $this->_client_soap->setCookie('X-Xdebug-Remote-Address', $xdebug_remote_address);
    $this->_client_soap->setCookie('Cookie', $xdebug_cookie);
}

$soap_string = $this->build_add_new_case_xml_string();

$ecase_response = $this->_client_soap->__doRequest(
    $soap_string,
    $this->ecase_wsdl,
    $this->service,
    SOAP_1_1
);

But I am getting the following SoapFault error message:

Function ("setCookie") is not a valid method for this service

What I am missing here? What is the right way to set a Cookie/Header? My PHP version is 5.3.3

Articles checked before:

  • 写回答

1条回答 默认 最新

  • dongtan5811 2018-11-13 18:12
    关注

    http://php.net/manual/en/soapclient.setcookie.php

    But seeing that the function is defined as magic, you're not supposed to call it directly.

    Take care.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 latex投稿显示click download
  • ¥15 请问读取环境变量文件失败是什么原因?
  • ¥15 在若依框架下实现人脸识别
  • ¥15 网络科学导论,网络控制
  • ¥100 安卓tv程序连接SQLSERVER2008问题
  • ¥15 利用Sentinel-2和Landsat8做一个水库的长时序NDVI的对比,为什么Snetinel-2计算的结果最小值特别小,而Lansat8就很平均
  • ¥15 metadata提取的PDF元数据,如何转换为一个Excel
  • ¥15 关于arduino编程toCharArray()函数的使用
  • ¥100 vc++混合CEF采用CLR方式编译报错
  • ¥15 coze 的插件输入飞书多维表格 app_token 后一直显示错误,如何解决?