我正在尝试创建一个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
我的Web服务代码如下:
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标记之前或之后有空格,但这不是问题所在。这个问题已经让我疯狂了好几个小时!非常感谢任何帮助。
__getLastResponse()
帮助我识别了无效字符。 - subroutines