gpt4 book ai didi

php - NuSoap soapClient 调用出现 "Premature end of data in tag html"错误

转载 作者:塔克拉玛干 更新时间:2023-11-03 06:01:01 25 4
gpt4 key购买 nike

我正在尝试调用我创建的网络服务,但服务器返回以下错误:

Fatal error: Uncaught SoapFault exception: [WSDL] SOAP-ERROR: Parsing WSDL: Couldn't load from 'http://www.savepoints.com.br/server.php?WSDL' : Premature end of data in tag html line 2 in /home/storage/a/39/1c/site1365816459/public_html/cliente.php:5 Stack trace: #0 /home/storage/a/39/1c/site1365816459/public_html/cliente.php(5): SoapClient->SoapClient('http://www.save...') #1 {main} thrown in /home/storage/a/39/1c/site1365816459/public_html/cliente.php on line 5

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

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');

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

关于php - NuSoap soapClient 调用出现 "Premature end of data in tag html"错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18237123/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com