【问题标题】:NuSoap soapClient call getting "Premature end of data in tag html" errorNuSoap soapClient 调用获取“标签 html 中的数据过早结束”错误
【发布时间】: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


    【解决方案1】:

    使用服务器 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');
    

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

    【讨论】:

      猜你喜欢
      • 2011-08-31
      • 1970-01-01
      • 2012-04-01
      • 2011-04-20
      • 1970-01-01
      • 1970-01-01
      • 2011-09-11
      • 2017-10-05
      • 1970-01-01
      相关资源
      最近更新 更多