SoapServer发送text/html标头,而不是text/xml


SoapServer sends text/html header instead of text/xml

我的soap服务器在响应头中发送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 GMT
服务器:Apache/2.2.20(Ubuntu)
X-Powered-Bor:PHP/5.3.6-13ubuntu3.6
设置Cookie:CAKEPHP=msmid2fijgrj1efjshotl8qfj1;expires=2012年3月19日星期一16:17:10 GMT;路径=/
P3P:CP="NOI ADM DEV PSAi COM NAV OUR OTRo STP IND DEM"
Vary:接受编码
内容编码:gzip
内容长度:877
内容类型:text/html/strong>;charset=UTF-8

我试着用text/xml conent类型调用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之前和之后,但没有结果。

(在问题编辑中回答。转换为社区wiki答案。请参阅没有答案的问题,但在评论中解决了问题(或在聊天中扩展))

OP写道:

解决后,它是一个сakephp功能。感谢"如何在cakepp中编写内容类型?"?

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();
    $this->RequestHandler->respondAs('text/xml');
}