【发布时间】:2013-08-14 16:22:09
【问题描述】:
我正在尝试调用我创建的网络服务,但服务器返回以下错误:
致命错误:未捕获的 SoapFault 异常:[WSDL] SOAP-ERROR:解析 WSDL:无法从“http://www.savepoints.com.br/server.php?WSDL”加载:/home/storage/a/39/ 中标记 html 行 2 中的数据过早结束1c/site1365816459/public_html/cliente.php:5 堆栈跟踪:#0 /home/storage/a/39/1c/site1365816459/public_html/cliente.php(5):SoapClient->SoapClient('http://www.save... ') #1 {main} 在第 5 行的 /home/storage/a/39/1c/site1365816459/public_html/cliente.php 中抛出
这里我展示了我的两个脚本:
server.php(它是 WSDL 服务器)
<?php
require('classes/nusoap/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);
?>
cliente.php
<?php
require('classes/nusoap/nusoap.php');
$c = new SoapClient('http://www.savepoints.com.br/server.php?WSDL');
$stockprice = $c->call('getStockQuote',array('symbol' => 'ABC'));
echo "The stock price for 'ABC' is ".$stockprice.".";
?>
【问题讨论】:
标签: php web-services wsdl nusoap