Reputation: 41
My soap server sends Content-Type: text/html in the response header. I need Content-type: 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();
}
Here is server's response:
HTTP/1.1 200 OK
Date: Mon, 19 Mar 2012 12:17:10 GMT
Server: Apache/2.2.20 (Ubuntu)
X-Powered-By: PHP/5.3.6-13ubuntu3.6
Set-Cookie: CAKEPHP=msmid2fijgrj1efjs0otl8qfj1; expires=Mon, 19-Mar-2012 16:17:10 GMT; path=/
P3P: CP="NOI ADM DEV PSAi COM NAV OUR OTRo STP IND DEM"
Vary: Accept-Encoding
Content-Encoding: gzip
Content-Length: 877
Content-Type: text/html; charset=UTF-8
I've tried to call header() with text/xml conent type
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();
}
before and after constructing SoapServer, but no result.
Upvotes: 0
Views: 3327
Reputation: 5893
(Answered in a question edit. Converted to a community wiki answer. See Question with no answers, but issue solved in the comments (or extended in chat) )
The OP wrote:
Solved, it was a сakephp feature. Thanks to How to write content type in cakephp?
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'); }
Upvotes: 1