PHP SoapServer return empty response on function without return

539 Views Asked by At

i have a soap with a method that return nothing

class mySoapService {
   foo(){

   }
}

$wsdl = ...;

$soapService = new mySoapService();

$soapServer = new \SoapServer($wsdl);
$soapServer->setObject($soapService);
$soapServer->handle(); // write nothing on call foo

some soap client raise an exception because they expect a proper xml-soap empty response, like this:

<?xml version="1.0"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/">
    <SOAP-ENV:Body SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
    </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

the questions are:

  1. why PHP SoapServer return an empty response and not a xml-soap empty response?

  2. what say the soap standard for method without return a value?

1

There are 1 best solutions below

0
On

Changing

$soapServer->handle();

to

$soapServer->handle(file_get_contents("php://input"));

worked for me