NuSoap soapClient调用获取“;标签html中的数据过早结束“;错误


NuSoap soapClient call getting "Premature end of data in tag html" error

我试图调用我创建的Web服务,但服务器返回以下错误:

致命错误:未捕获的SoapFault异常:[WSDL]SOAP-error:正在分析WSDL:无法从"加载http://www.savepoints.com.br/server.php?WSDL":/home/storage/a/39/1c/site1365816459/public_html/cliente.php:5堆栈跟踪:#0/home/sttorage/a/39/1c/site1365816459/1public_html-cliente.php(5):SoapClient->SoapClient("http://www.save...')在第5行的/home/storage/a/39/1c/site1365816459/public_html/client.php中抛出#1{main}

在这里,我展示了我的两个脚本:

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.".";
?>

使用服务器NuSOAP和客户端PHP-SOAP

用途:

$c = new SoapClient('http://www.savepoints.com.br/server.php?wsdl');

代替:

$c = new SoapClient('http://www.savepoints.com.br/server.php?WSDL');

我不知道为什么,但它对我有效。