我有一个带有nussoap库和nussoap在php 5.3和5.5上工作良好的web服务,但目前我正在php 5.6上工作,在使用nussoap库时遇到以下错误:
Automatically populating $HTTP_RAW_POST_DATA is deprecated and will be removed in a future version. To avoid this warning set 'always_populate_raw_post_data' to '-1' in php.ini and use the php://input stream instead. in Unknown on line 0
我对这个问题做了很多调查,但没有成功。
我试图找到与php 5.6兼容的nussoap版本,但找不到任何解决方案,最后决定使用SoapServer和SoapClient,并使用以下代码进行测试:
<?php
class MyAPI {
function hello() {
return "Hello";
}
}
$options=array('uri'=>'http://xx.com:800/webservice/');
$server = new SoapServer(NULL,$options);
$server->setClass('MyAPI');
$server->handle();
?>
和以下作为客户端文件:
<?php
$options = array('location' => 'http://xx.com:800/webservice/server.php',
'uri' => 'http://xx.com:800/webservice/');
$api = new SoapClient(NULL, $options);
echo $api->hello();
?>
但是当我调用客户端文件时,我遇到以下错误:
Fatal error: Uncaught SoapFault exception: [Client] looks like we got no XML document in PATHwebserviceclient.php:11 Stack trace: #0 PATHwebserviceclient.php(11): SoapClient->__call('hello', Array) #1 PATHwebserviceclient.php(11): SoapClient->hello() #2 {main} thrown in PATHwebserviceclient.php on line 11
你能给我好的最好的解决方案吗?
$HTTP_POST_RAW_DATA在PHP 5.6中已弃用使用file_get_contents("php://input");