Webservice error
- by Parth
i am new to webservices,
I have created a basic stockmarket webservice, I have successfully created the server script for it and placed it in my server, Now I also creted a clent script and accessed it hruogh the same server.. Is it valid ? can boh files be accesed from the same server? or do I have to place them in different servers? If yes Then Y? If No then why do i get the blank page?
I am using nusoap library for webservice.
When I use my cleint script from my local machine I get these errors
"Deprecated: Assigning the return
value of new by reference is
deprecated in
D:\wamp\www\pranav_test\nusoap\lib\nusoap.php
on line 6506
Fatal error: Class 'soapclient' not
found in
D:\wamp\www\pranav_test\stockclient.php
on line 3"
stockserver.php at server
<?php
function getStockQuote($symbol) {
mysql_connect('localhost','root','******');
mysql_select_db('pranav_demo');
$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/lib/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);
?>
stockclient.php
<?php
require_once('nusoap/lib/nusoap.php');
$c = new soapclient('http://192.168.1.20/pranav_test/stockserver.php');
$stockprice = $c->call('getStockQuote',
array('symbol' => 'ABC'));
echo "The stock price for 'ABC' is $stockprice.";
?>
please help...