脚本宝典收集整理的这篇文章主要介绍了在PHP中记录所有Soap请求和响应,脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。
class SoapClientLOGger { PRotected $soapClient; // wrapping the SoapClient instance with the decorator public function __construct(SoapClient $client) { $this->soapClient = $client; } // overloading __doRequest with your logging code function __doRequest($request,$location,$action,$version,$one_way = 0) { $this->log($request,$version); $response = $this->soapClient->__doRequest($request,$one_way); $this->log($response,$version); return $response; } public function log($request,$version) { // here you Could add filterings to log only items,e.g. if($action === 'foo') { // code to log item } } // route all other method calls directly to soapClient public function __call($method,$args) { // you Could also add method_exists check here return call_user_func_array(array($this->soapClient,$method),$args); } }
以上是脚本宝典为你收集整理的在PHP中记录所有Soap请求和响应全部内容,希望文章能够帮你解决在PHP中记录所有Soap请求和响应所遇到的问题。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。