I want to return an array of article objects in a PHP web service, using nuSOAP v 1.114. This is how I set up the WSDL:
$server->wsdl->addComplexType(
I fixed this error. For anyone interested, this seems to be a bug in NuSOAP. You MUST register your returnType for the function as xsd:Array for it to correctly return the array, even though correct WSDL would constitute it as 'tns:ArrayOfArticleType'. I found this in some Drupal source code:
// Set return value for the service
$return = array();
if ($method['#return']) {
**// Don't let a struct be declared as return parameter, because nusoap will not
// Send back anything.**
$return['return'] = 'xsd:'. $method['#return'];
if ($method['#return'] == 'struct' || $method['#return'] == 'array') {
$return['return'] = 'xsd:Array';
}
}
Hope this helps someone else who struggled with the same problem.
Here is example both client and server for how to return an array with php web service.It is easy example to understand http://my-source-codes.blogspot.com/2011/10/php-web-service-return-array.html