Estoy intentanto crear un Web Service con Zend-SOAP pero estoy parado ya que no se como enviar arrays.
La idea es tener un metodo getAllUsers() y que este me entrege un array con todos los usuarios.
hasta ahora tengo esto
Service.php
Código PHP:
<?php
/**
* Service Class
*/
class Service
{
/**
* Obtener la lista de Clientes
* @return array
*/
public function getCustomers()
{
$customers = array(
1 => array('fist_name' => 'XXXX'),
2 => array('fist_name' => 'XXXX'),
);
return $customers;
}
}
Código PHP:
<?php
require_once 'vendor/autoload.php';
use ZendSoapAutoDiscover;
$wsdl = new AutoDiscover();
$wsdl->setClass('Service')
->setUri('http://dev/soap/zend/soap_server.php?wsdl')
->setServiceName('SakilaService')
->handle();
Client.php
Código PHP:
<?php
require_once 'vendor/autoload.php';
use ZendSoapClient;
$client = new Client('http://dev/soap/zend/soap_server.php?wsdl');
print_r($client->getCustomers());
y obtengo lo siguiente:
Cita:
Fatal error: Uncaught SoapFault exception: [VersionMismatch] Wrong Version in C:\xampp\htdocs\Developer\soap\zend\vendor\zendfra mework\zend-soap\Zend\Soap\Client.php:1118 Stack trace: #0 C:\xampp\htdocs\Developer\soap\zend\vendor\zendfra mework\zend-soap\Zend\Soap\Client.php(1118): SoapClient->__soapCall('getCustomers', Array, NULL, NULL, Array) #1 C:\xampp\htdocs\Developer\soap\zend\soap_client.ph p(8): Zend\Soap\Client->__call('getCustomers', Array) #2 C:\xampp\htdocs\Developer\soap\zend\soap_client.ph p(8): Zend\Soap\Client->getCustomers() #3 {main} thrown in C:\xampp\htdocs\Developer\soap\zend\vendor\zendfra mework\zend-soap\Zend\Soap\Client.php on line 1118
Fatal error: Uncaught SoapFault exception: [VersionMismatch] Wrong Version in C:\xampp\htdocs\Developer\soap\zend\vendor\zendfra mework\zend-soap\Zend\Soap\Client.php:1118 Stack trace: #0 C:\xampp\htdocs\Developer\soap\zend\vendor\zendfra mework\zend-soap\Zend\Soap\Client.php(1118): SoapClient->__soapCall('getCustomers', Array, NULL, NULL, Array) #1 C:\xampp\htdocs\Developer\soap\zend\soap_client.ph p(8): Zend\Soap\Client->__call('getCustomers', Array) #2 C:\xampp\htdocs\Developer\soap\zend\soap_client.ph p(8): Zend\Soap\Client->getCustomers() #3 {main} thrown in C:\xampp\htdocs\Developer\soap\zend\vendor\zendfra mework\zend-soap\Zend\Soap\Client.php on line 1118
Amigos espero que me puedan ayudar, he intentado ir a la documentacion pero la verdad no logro entendarla del todo.
Saludos!