我正在尝试创建一个 Web 服务,但在此之前,我试图获得一个我在互联网上找到的简单示例,但我一直收到以下错误:
Fatal error: Uncaught SoapFault exception: [Client] looks like we got no XML document in C:\Documents and Settings\geoff\My Documents\Websites\jquery\index.php:20 Stack trace: #0 [internal function]: SoapClient->__call('getStockQuote', Array) #1 C:\Documents and Settings\geoff\My Documents\Websites\jquery\index.php(20): SoapClient->getStockQuote(Array) #2 {main} thrown in C:\Documents and Settings\geoff\My Documents\Websites\jquery\index.php on line 20
我正在使用 nusoap v1.94
我的网络服务代码如下所示:
function getStockQuote($symbol) {
$price = '1.23';
return $price;
}
require('nusoap.php');
$server = new soap_server();
$server->configureWSDL('stockserver', 'urn:stockquote');
$server->register("getStockQuote",
array('symbol' => 'xsd:string'),
array('return' => 'xsd:decimal'),
'urn:stockquote',
'urn:stockquote#getStockQuote');
$HTTP_RAW_POST_DATA = isset($HTTP_RAW_POST_DATA)
? $HTTP_RAW_POST_DATA : '';
$server->service($HTTP_RAW_POST_DATA);
我知道一个原因是在服务器脚本中的 php 标记之前或之后有空格,但事实并非如此。它已经让我发疯了好几个小时!任何帮助将非常感激。