代码之家  ›  专栏  ›  技术社区  ›  ReynierPM

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

  •  0
  • ReynierPM  · 技术社区  · 6 年前

    我正在尝试启用xDebug对SOAP调用的支持,以下是我发现的几个主题(请参阅本文末尾的列表),这是我迄今为止所做的工作:

    $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
    );
    

    SoapFault 错误消息:

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

    我错过了什么?设置Cookie/标题的正确方法是什么?我的PHP版本是5.3.3

    之前检查的物品:

    1 回复  |  直到 6 年前
        1
  •  1
  •   AnrDaemon    6 年前

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

    但是看到函数被定义为magic,就不应该直接调用它。