[SoapServer] Removed headers added by SoapServer::handle() method

This commit is contained in:
Francis Besset 2013-11-06 16:48:44 +01:00
parent e9429a5d03
commit 7fa666e9de
2 changed files with 10 additions and 9 deletions

View File

@ -51,12 +51,9 @@ class SoapResponse extends CommonSoapResponse
public function send() public function send()
{ {
// set Content-Type header // set Content-Type header
header('Content-Type: ' . $this->getContentType()); header('Content-Type: '.$this->getContentType());
// get content to send
$response = $this->getContent(); // send content to client
// set Content-Length header echo $this->getContent();
header('Content-Length: '. strlen($response));
// send response to client
echo $response;
} }
} }

View File

@ -95,6 +95,10 @@ class SoapServer extends \SoapServer
parent::handle($soapRequest->getContent()); parent::handle($soapRequest->getContent());
$response = ob_get_clean(); $response = ob_get_clean();
// Remove headers added by SoapServer::handle() method
header_remove('Content-Length');
header_remove('Content-Type');
// wrap response data in SoapResponse object // wrap response data in SoapResponse object
$soapResponse = SoapResponse::create( $soapResponse = SoapResponse::create(
$response, $response,
@ -158,4 +162,4 @@ class SoapServer extends \SoapServer
); );
} }
} }
} }