PHP SoapServer对函数返回空响应,不返回

时间:2018-11-07 09:18:22

标签: php soap soapserver

我有一个肥皂,它的方法什么也不返回

class mySoapService {
   foo(){

   }
}

$wsdl = ...;

$soapService = new mySoapService();

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

一些肥皂客户端引发异常,因为他们期望正确的xml-soap空响应,如下所示:

<?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>

问题是:

  1. 为什么PHP SoapServer返回空响应而不是xml-soap空响应?

  2. 怎么说肥皂标准而不返回值?

1 个答案:

答案 0 :(得分:0)

更改

$soapServer->handle();

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

为我工作