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

10,255

With server NuSOAP and client PHP-SOAP.

Use:

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

Instead of:

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

I do not know why, but it works for me.

Share:
10,255
someone_learning
Author by

someone_learning

Updated on June 08, 2022

Comments

  • someone_learning
    someone_learning almost 2 years

    I'm trying to call a webservice that I've created, but the server is returning the following error:

    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

    Here I show my two scripts:

    server.php (it's the WSDL server)

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