Hello webdeveloper,
I have a php/nusoap script with the following problem:
The script works well accept one thing:
The function shows only one result on my screen. I know there are more items with those conditions. Here are the server and client script.
Client
[code=php]
<?php
error_reporting(E_ALL);
require_once(‘lib/nusoap.php’);
$wsdl=”http://localhost:80/stockserver.php?wsdl”;
$c = new nusoap_client(“http://localhost/stockserver.php?wsdl”, true);
$proxy = $c->getProxy();
$rows = $proxy->call(‘getStockQuote’, array(‘VVSUBGROEPA’ => ‘Rond’, ‘VVHOOFDGROEP’ => ‘RVS’));
echo “Item ‘RVS’ ‘Rond’ is $rows.”;
?>
Server
[code=php]
<?php
error_reporting(E_ALL);
function getStockQuote($symbol) {
$prod_conn=odbc_connect(“Nfsupplies”,”test”,”test”,””);
if (!$prod_conn)
{
exit(“<font color=’#FF0000′>Can’t connect:</font> ” . $prod_conn);
}
$query = “select CDARTIKEL FROM ARTIKEL WHERE (VVSUBGROEPA Like ‘$symbol’) AND VVOPWEB = ‘Ja'”;
$result = odbc_exec($prod_conn, $query);
if (!$result)
{
exit(“<font color=’#FF0000′>error in sql:</font> ” . $result);
}
while ($row = odbc_fetch_array($result)){
return $row[‘CDARTIKEL’];
}
}
require(‘lib/nusoap.php’);
$server = new soap_server();
$server->configureWSDL(‘stockserver’, ‘urn:stockquote’);
$server->register(“getStockQuote”,
array(‘VVSUBGROEPA’ => ‘xsd:string’),
array(‘return’ => ‘xsd:string’),
‘urn:stockquote’,
‘urn:stockquote#getStockQuote’);
//$HTTP_RAW_POST_DATA = isset($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA : ”;
//$server->service($HTTP_RAW_POST_DATA);
$server->service(file_get_contents (‘php://input’));
?>
How can I get more items? If I add this(below) in server:
[code=php]
$aData = array();
while ( $row = odbc_fetch_array( $result ) )
{
$aData[] = $row[‘CDARTIKEL’];
}
return $aData;
My output will be: Artikel ‘RVS’ ‘Rond’ is Array. instead of: Artikel ‘RVS’ ‘Rond’ is 673001001.
Can anyone help a desperate person? Thanx