0

I just started creating a soap service and at the end of the request of I need to be able to log the request and response.

ob_start();
try {
  $soapServer = new SoapServer(Smiggly::getSetting("network.soap.WSDLUrl"));
  $soapServer->setClass("SoapController");
  $soapServer->handle();
} catch(SoapFault $e) {
}

$response = ob_get_contents();
ob_end_flush();
flush();

The problem is that if one of the methods triggers a soap fault it would appear the soap server stops the php execution. I have tried putting the code in a try/catch block and execution still appears to stop.

The code above works fine for responses which do not error. Does anyone have a way to pull the response out before the script execution ends?

Computer User
  • 546
  • 9
  • 15
  • How did you implement the try/catch? Did you catch `SoapFault` or `Exception`? – ʰᵈˑ Nov 26 '15 at 09:31
  • I have tried both. When a SoapFault is thrown or returned from a method the SoapServer formats this into the expected Fault xml response. However, it doesn't process any code after the handle method. It is almost as if the library itself call's exit after sending the response. – Computer User Nov 26 '15 at 11:20
  • Can you update your question with the try/catch logic, please – ʰᵈˑ Nov 26 '15 at 11:40
  • Updated it. Also found this issue from 6 years ago. https://bugs.php.net/bug.php?id=49513 Feels like this is what I am running in to. If this is what is happening then I don't understand how people are running SoapServer unless they are doing the logging outside of php – Computer User Nov 26 '15 at 13:05

0 Answers0