vamos al grano, tengo el siguiente problema, estoy trabajando con nusoap y php tengo mi server y mi client.
consumo mi web service, pero el cliente me retorna un error, me dice que no devuelvo un xml....
el server devuelvo un array o datalist
Código PHP:
<?php
// Pull in the NuSOAP code
require_once('lib/nusoap.php');
// Create the server instance
$server = new soap_server();
// Initialize WSDL support
$server->configureWSDL('pruebaWSDL', 'urn:pruebaWSDL');
// Register the data structures used by the service
$server->wsdl->addComplexType (
'Provincia',
'complexType',
'struct',
'all',
'',
array (
'account' => array('name' => 'account', 'type' => 'xsd:string')
)
);
$server->wsdl->addComplextype (
'Provincias',
'complexType',
'array',
'',
'SOAP-ENC:Array',
array(),
array(
array('ref' => 'SOAP-ENC:arrayType',
'wsdl:arrayType' => 'tns:Provincia[]')
),
'tns:Provincias'
);
// Register the method to expose
$server->register('obtenerListaProvincias', // method name
array(), // input parameters
array('return' => 'tns:Provincias'), // output parameters
'urn:pruebaWSDL', // namespace
'urn:pruebaWSDL#obtenerListaProvincias', // soapaction
'rpc', // style
'encoded', // use
'Greet a person entering the sweepstakes' // documentation
);
function obtenerListaProvincias() {
connectdb("lin2db_db", "127.0.0.1", "sa", "");
$sql = 'SELECT TOP 10 email FROM user_email;';
$result = mssql_query($sql);
$numrows = mssql_num_rows($result);
if (!$result) {
return new soapfault('SOAP-ENV: Server', '', 'Se ha producido un error en la consulta. Por favor, inténtelo más tarde');
}
if ($numrows < 1) {
return new soapfault('SOAP-ENV: Server', '', 'No se han encontrado provincias con dicho identificador');
}
$array = array();
//$row = mysql_fetch_assoc($result);
while ($row = mysql_fetch_assoc($result)) {
$array[] = array('name' => $row['email']);
}
return new soapval ('return', 'tns:Provincias', $array);
}
$HTTP_RAW_POST_DATA = isset($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA : '';
$server->setDebugLevel(1);
$server->service($HTTP_RAW_POST_DATA);
function connectdb($db, $dbaddress, $dbuser, $dbpass) {
$dbconnect = mssql_connect($dbaddress, $dbuser, $dbpass);
if($dbconnect === false){
return false;
}else{
mssql_select_db ($db, $dbconnect) or die (mysql_error());
}
}
?>
ojala puedan ayudarme
saludos
P.D el cliente es un soap client normal.