NuSphere Forums Forum Index
NuSphere Forums
Reply to topic
Easy definition for "struct" and "array"


Joined: 21 Apr 2008
Posts: 10
Reply with quote
Hi,

Is there any easy definition for "struct" and "array"? In following code block what should I use (ideally).

Code:

$server->wsdl->addComplexType
    (
        'MainType',
        'complexType',
        'struct',
        'sequence',
        '',
        array
        (
            'Total'   => array('name' => 'Total',   'type' => 'xsd:positiveInteger'),
            'XYDetails' => array('name' => 'XYDetails', 'type' => 'XYDetailsType')
        )
    );


I want to know that when to use "struct" and when to "array"?

Regards,

Dave
View user's profileFind all posts by naimish_hitSend private message


Joined: 28 Apr 2008
Posts: 4
Reply with quote
You can use struct to organize your data as key-value pair, for instance
Code:
$server->wsdl->addComplexType(
  'Walk',
  'complexType',
  'struct',
  'all',
  '',
  array(
    'WalkId' => array('name' => 'WalkId',
         'type' => 'xsd:int'),
    'WalkTitle' => array('name' => 'WalkTitle',
         'type' => 'xsd:string'),
    'WalkDate' => array('name' => 'WalkDate',
        'type' => 'xsd:date')
    'WalkDescription' => array('name' => 'WalkDescription',
        'type' => 'xsd:string')
  )
);


And you can contain the structure within the array like this
Code:
$server->wsdl->addComplexType(
  'Walks',
  'complexType',
  'array',
  '',
  'SOAP-ENC:Array',
  array(),
  array(
    array('ref' => 'SOAP-ENC:arrayType',
         'wsdl:arrayType' => 'tns:Walk[]')
  ),
  'tns:Walk'
);


Reference:
View user's profileFind all posts by tristanSend private message
Easy definition for "struct" and "array"
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
All times are GMT - 5 Hours  
Page 1 of 1  

  
  
 Reply to topic