Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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

?>
like image 728
someone_learning Avatar asked Aug 14 '13 16:08

someone_learning


1 Answers

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.

like image 76
Gustavo González Avatar answered Oct 14 '22 22:10

Gustavo González