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.

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

报告相同问题?

悬赏问题

  • ¥20 关于#qt#的问题:Qt代码的移植问题
  • ¥50 求图像处理的matlab方案
  • ¥50 winform中使用edge的Kiosk模式
  • ¥15 关于#python#的问题:功能监听网页
  • ¥15 怎么让wx群机器人发送音乐
  • ¥15 fesafe材料库问题
  • ¥35 beats蓝牙耳机怎么查看日志
  • ¥15 Fluent齿轮搅油
  • ¥15 八爪鱼爬数据为什么自己停了
  • ¥15 交替优化波束形成和ris反射角使保密速率最大化