2018-11-13 17:08
浏览 195

如何在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(
        '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(

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

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

    Take care.

    解决 无用
    打赏 举报

相关推荐 更多相似问题