Created
November 12, 2014 14:07
-
-
Save alfaproject/051f3fc7989c61ac7373 to your computer and use it in GitHub Desktop.
SoapServer sub class for debugging requests and responses
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class DebugSoapServer extends SoapServer | |
{ | |
public function handle($request = null) | |
{ | |
// check input param | |
if ($request === null) { | |
$request = file_get_contents('php://input'); | |
} | |
// store the request string | |
$requestSignature = md5($request); | |
file_put_contents('/tmp/soap_' . $requestSignature . '_request', $request); | |
// start output buffering | |
ob_start(); | |
// finaly call SoapServer::handle() - store result | |
$result = parent::handle($request); | |
// store the response string | |
file_put_contents('/tmp/soap_' . $requestSignature . '_response', ob_get_contents()); | |
// flush buffer | |
ob_flush(); | |
// return stored soap-call result | |
return $result; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment