[英]$_REQUEST['url] is empty. How to get controller and methods from $_REQUEST['url']? Bitnami WAMP
[英]LastRequest is empty, POST is empty. How to get the XML request from Zend Soap Server?
我已经用下面的代码实现了一个zend soap服务器。 为了我的目的,我需要能够访问完整的XML消息或至少访问它的标头。 但是,SoapServer上的getLastRequest方法返回空,并且所有超全局变量(例如$ _GET,$ _ POST和whatnot)也都为空。 有人有什么想法吗?
class SoapTest
{
protected $server;
public function __construct(\Zend\Soap\Server $server)
{
$this->server = $server;
}
/***
* @param string $requestIn
* @return string
*/
public function test($requestIn)
{
// access XML here
}
}
$serverUrl = "http://localhost/SoapTest.php";
$options = [
'uri' => $serverUrl,
];
$server = new Zend\Soap\Server(null, $options);
if (isset($_GET['wsdl'])) {
$soapAutoDiscover = new \Zend\Soap\AutoDiscover(new \Zend\Soap\Wsdl\ComplexTypeStrategy\ArrayOfTypeSequence());
$soapAutoDiscover->setBindingStyle(array('style' => 'document'));
$soapAutoDiscover->setOperationBodyStyle(array('use' => 'literal'));
$soapAutoDiscover->setClass(SoapTest::class);
$soapAutoDiscover->setUri($serverUrl);
header("Content-Type: text/xml");
echo $soapAutoDiscover->generate()->toXml();
} else {
$soap = new \Zend\Soap\Server($serverUrl . '?wsdl', array('cache_wsdl' => WSDL_CACHE_NONE));
$soap->setObject(new \Zend\Soap\Server\DocumentLiteralWrapper(new SoapTest($soap)));
$soap->handle();
}
显然,Zend Soap Server在句柄之后填充了$ request属性(在getLastRequest中返回),因此我无法在我的方法中访问它。
但是,我可以通过调用以下命令来访问XML:
$request = file_get_contents('php://input');
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.