如何在 PHP 中为 SOAP 客户端正确设置 Cookie/Header?
How to properly set a Cookie/Header for a SOAP client in PHP?
我正在尝试启用 xDebug 对 SOAP 调用的支持,遵循我在那里发现的几个主题(请参阅本文末尾的列表 post),这是我到目前为止所做的:
$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/Header 的正确方法是什么?我的 PHP 版本是 5.3.3
之前检查过的文章:
- https://gist.github.com/Marko-M/10238b76c268ca9d47e5
- Debugging a SOAP service using xDebug
- http://www.practicalweb.co.uk/blog/2010/10/14/debugging-soap-with-xdebug-and-eclipse/
- Nusoap set and get headers in both client and server side
http://php.net/manual/en/soapclient.setcookie.php
但是看到这个函数被定义为魔法,你不应该直接调用它。
保重。
我正在尝试启用 xDebug 对 SOAP 调用的支持,遵循我在那里发现的几个主题(请参阅本文末尾的列表 post),这是我到目前为止所做的:
$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/Header 的正确方法是什么?我的 PHP 版本是 5.3.3
之前检查过的文章:
- https://gist.github.com/Marko-M/10238b76c268ca9d47e5
- Debugging a SOAP service using xDebug
- http://www.practicalweb.co.uk/blog/2010/10/14/debugging-soap-with-xdebug-and-eclipse/
- Nusoap set and get headers in both client and server side
http://php.net/manual/en/soapclient.setcookie.php
但是看到这个函数被定义为魔法,你不应该直接调用它。
保重。