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.

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

报告相同问题?

悬赏问题

  • ¥30 这是哪个作者做的宝宝起名网站
  • ¥60 版本过低apk如何修改可以兼容新的安卓系统
  • ¥25 由IPR导致的DRIVER_POWER_STATE_FAILURE蓝屏
  • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
  • ¥50 有数据,怎么用matlab求全要素生产率
  • ¥15 TI的insta-spin例程
  • ¥15 完成下列问题完成下列问题
  • ¥15 C#算法问题, 不知道怎么处理这个数据的转换
  • ¥15 YoloV5 第三方库的版本对照问题
  • ¥15 请完成下列相关问题!