<?php
include('nuSoap/lib/nusoap.php');
include('ComplexHelper.class.php');
$server = new soap_server;
$nuHelper = new ComplexHelper($server);
// WSDL Support
$server->configureWSDL('My WSDL Services', 'urn:server.businessData');
$server->wsdl->schemaTargetNamespace = 'urn:server.businessData';
mysql_connect('localhost', 'R0oT', 'N0n3P4s5');
mysql_select_db('epoc2h');
$nuHelper->SimpleComplexType('cliente')->bindArray('Arr');
// registra o método a ser oferecido
$server->register('last10', //method name
array(), //in
array('return' => 'tns:Arrcliente'), //out
'urn:server.businessData', //namespace
'urn:server.businessData#businessData', //soapaction
'rpc', //style
'encoded', //use
'get information of the latest 10 clients' //description
);
function last10() {
$qry = "select * from cliente order by cod_cli DESC limit 10 ";
$rs = mysql_query($qry);
if (mysql_numrows($rs) > 0) {
$dados = array();
while ($row = mysql_fetch_array($rs, MYSQL_ASSOC)) {
$dados[] = $row;
}
}
return $dados;
}
// requisição para uso do serviço
$HTTP_RAW_POST_DATA = isset($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA : '';
$server->service($HTTP_RAW_POST_DATA);
?>
|