views:

87

answers:

2

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

+1  A: 

Please post a piece of source code.

Yes you can access your webservice from a client which is also located on the same server.

For testing webservices I recommend SoapUI, which is available for all platforms.

I recommend to use the build in soap extension of php then nusoap, it's an rather old library.

Alex
U mean to say Same machine can work for me isnt it?
OM The Eternity
yes that's right.
Alex
+1  A: 

I'm really very new to PHP but i found the same error when i was working with nusoap. what i understood that in php 5 you can't assign the return value of new object using referencing ( using the & operator) so simply... Remove it :D... I did that i it worked.

Ahmed Abdelghany