formatting of output when '#return' => 'struct'

pastk - May 23, 2008 - 20:39
Project:SOAP Server
Version:5.x-1.x-dev
Component:Code
Category:support request
Priority:normal
Assigned:Unassigned
Status:active
Description

Hello!

When I invoke a node.load method I get response in the following inconvenient form:

Array
(
    [0] => Array
        (
            [title] => nid
            [value] => 13
        )

    [1] => Array
        (
            [title] => language
            [value] => en
        )

    [2] => Array
        (
            [title] => title
            [value] => Scissors
        )
)

instead of very nice

Array
(
    [nid] => 13
    [language] => en
    [title] => Scissors
)

This is due to the following code found in soap_server.module:

  // I've found that input is not a problem as nusoap deals well with the arguments, even if they
  // are structs in the client side, but the return should be formated to the right type. To do
  // this we need to parse again the exposed services list.

  $oh = array();
  foreach (get_object_vars($ret) as $name => $val){
  $oh[] = array('title' => $name, 'value'=>$val);
    //$oh[$name] = $val;
  }

  return (array)$oh;

So, what is the rationale behind it? I found it much more convenient to wipe it out :)

 
 

Drupal is a registered trademark of Dries Buytaert.