【发布时间】:2012-04-03 23:24:27
【问题描述】:
我的肥皂服务器在响应标头中发送 Content-Type: text/html。我需要内容类型:text/xml。
public function index()
{
$this->layout = 'soap';
ini_set("soap.wsdl_cache_enabled", "0");
$this->server = new SoapServer('wsdl/tur.wsdl', array(
'soap_version' => SOAP_1_2,
));
$this->server->setObject($this);
$this->server->handle();
}
这是服务器的响应:
HTTP/1.1 200 正常
日期:格林威治标准时间 2012 年 3 月 19 日星期一 12:17:10
服务器:Apache/2.2.20 (Ubuntu)
X-Powered-By:PHP/5.3.6-13ubuntu3.6
设置 Cookie:CAKEPHP=msmid2fijgrj1efjs0otl8qfj1;过期=格林威治标准时间 2012 年 3 月 19 日星期一 16:17:10;路径=/
P3P:CP="NOI ADM DEV PSAi COM NAV OUR OTRo STP IND DEM"
变化:接受编码
内容编码:gzip
内容长度:877
内容类型:text/html;字符集=UTF-8
我尝试使用 text/xml 内容类型调用 header()
public function index()
{
$this->layout = 'soap';
ini_set("soap.wsdl_cache_enabled", "0");
header("Content-Type: text/xml");
$this->server = new SoapServer('wsdl/tur.wsdl', array(
'soap_version' => SOAP_1_2,
));
$this->server->setObject($this);
$this->server->handle();
}
构建SoapServer前后,但没有结果。
【问题讨论】:
-
从未使用过此功能,但在文档中有
SoapServer::addSoapHeader您是否尝试过覆盖 Content-Type? -
根据
handle文档上的评论,“...SoapServer::handle();方法向浏览器发送额外的 HTTP 标头。其中之一是 'Content-Type: application/soap+xml ’。”不是真正的答案,但可能会提供一些见解。
标签: php soapserver