« Return to Thread: WSDL error can someone help

Re: WSDL error can someone help

by rmeel :: Rate this Message:

| View in Thread

Got the solution dont change anything other than these two :
1) $c = new soapclient("http://localhost/nusoap/stockserver.php"); to
$c = new soapclient("http://localhost/nusoap/stockserver.php?wsdl");
2) $stockprice = $c->call('getStockQuote', array('symbol' => 'ABC')); to
$stockprice = $c->__call('getStockQuote', array('symbol' => 'ABC'));

Hope this works

Regards,
Ravinder
Dooley wrote:
Hi all,

I'm getting a strange error when using nusoap with php, both host and client are on a local machine.

Here is the server code.
<?php
function getStockQuote($symbol) {

    mysql_connect('localhost','user','password');
    mysql_select_db('database');
    $query = "SELECT stock_price FROM stockprices "
           . "WHERE stock_symbol = '$symbol'";
    $result = mysql_query($query);
   
    $row = mysql_fetch_assoc($result);
    return $row['stock_price'];
}
        require('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);
?>

When I connect to this via a web browser I can view the wsdl for the service and all seems grand.

This is the client code.

<?php
require_once('nusoap.php');

$c = new soapclient('http://localhost:80/distribsys/newtest/server.php');

$stockprice = $c->call('getStockQuote',array('symbol' => 'ABC'));

echo "The stock price for 'ABC' is $stockprice.";

?>

When i connect I get this error

Fatal error: Uncaught SoapFault exception: [WSDL] SOAP-ERROR: Parsing WSDL: Couldn't load from 'http://localhost:80/distribsys/newtest/server.php' in /var/www/distribsys/newtest/client.php:4 Stack trace: #0 /var/www/distribsys/newtest/client.php(4): SoapClient->SoapClient('http://localhos...') #1 {main} thrown in /var/www/distribsys/newtest/client.php on line 4

I cannot solve this, I have looked all over the web for solutions and no luck, can anyone guess what could be potentially wrong with this, thanks very much in advance, any help is greatly appreciated.

 « Return to Thread: WSDL error can someone help