NuSphere Forums Forum Index
NuSphere Forums
Reply to topic
Array in Struct


Joined: 08 Jan 2005
Posts: 2
Location: Stuttgart - Germany
Reply with quote
Hy,

what I need for my project is an Array of Structures. Where the Structure contains another Array.
Is that possible?

Here is what I have so far:
-------------------------------------------------------
$server->wsdl->addComplexType(
'zeile_rc',
'complexType',
'struct',
'all',
'',
array(
'keyword' => array('name' => 'keyword', 'type' => 'xsd:string'),
'such1' => array('name' => 'such1', 'type' => 'xsd:int')
'such2' => array('name' => 'such2', 'type' => 'xsd:int')
'such3' => array('name' => 'such3', 'type' => 'xsd:int')
'such4' => array('name' => 'such4', 'type' => 'xsd:int')
'such5' => array('name' => 'such5', 'type' => 'xsd:int')
)
);

$server->wsdl->addComplexType(
'zeilen_rc',
'complexType',
'array',
'',
'SOAP-ENC:Array',
array(),
array(
array('ref' => 'SOAP-ENC:arrayType', 'wsdl:arrayType' => 'tns:zeile_rc[]')
),
'tns:zeile_rc'
);

------------------------------------------------------------------

Now I would like to replace the such1 to such5 with an array.
I don't understand how this could be achieved.

Thanks,
Markus
View user's profileFind all posts by BrujahSend private messageICQ Number
Site Admin

Joined: 13 Jul 2003
Posts: 8334
Reply with quote
you may want to read this article
http://www.scottnichol.com/nusoapintro.htm
http://www.scottnichol.com/nusoapprog.htm
http://www.scottnichol.com/nusoapprog2.htm
http://www.scottnichol.com/nusoapprogwsdl.htm
View user's profileFind all posts by dmitriSend private messageVisit poster's website


Joined: 06 Sep 2005
Posts: 7
Reply with quote
i have the same question

the links do not really provide a straight forward answer

could anyone provide an example?

EDIT: i solved this for myself so here it is for anyone else:

Code:
//This creates Boxes with multiple items in them

$namespace = "urn:Service";

$server->debug_flag=false;
$server->configureWSDL('Service', $namespace);
$server->wsdl->schemaTargetNamespace = $namespace;

$server->wsdl->addComplexType(
   'Box',
   'complexType',
   'struct',
   'all',
   '',
   array
   (
      'BoxId' => array('name' => 'BoxId', 'type' => 'xsd:int'),
      'Name' => array('name' => 'Name', 'type' => 'xsd:string'),
      'Items' => array('name' => 'Items', 'type' => 'tns:Items')
   )
);

$server->wsdl->addComplexType(
   'Item',
   'complexType',
   'struct',
   'all',
   '',
   array
   (
      'ItemId' => array('name' => 'ItemId', 'type' => 'xsd:int'),
      'ItemDescrip' => array('name' => 'ItemDescrip', 'type' => 'xsd:int'),
   )
);


$server->wsdl->addComplexType(
    'Boxes',
    'complexType',
    'array',
    'all',
    'SOAP-ENC:Array',
    array(),
    array
    (
       array
       (
          'ref'=>'SOAP-ENC:arrayType','wsdl:arrayType'=>'tns:Box[]'
       )
    ),
   'tns:Box'
);

$server->wsdl->addComplexType(
    'Items',
    'complexType',
    'array',
    'all',
    'SOAP-ENC:Array',
    array(),
    array
    (
       array
       (
          'ref'=>'SOAP-ENC:arrayType','wsdl:arrayType'=>'tns:Item[]'
       )
    ),
   'tns:Item'
);

$server->register
(
   'getObjects',
   array('Id'=>'xsd:int'),
   array('return'=>'tns:Boxes'),
   $namespace,
   '',
   false,
   'encoded',
   'Get Boxes'
);
View user's profileFind all posts by wmpurSend private message
Site Admin

Joined: 13 Jul 2003
Posts: 8334
Reply with quote
thanks for your sample!
View user's profileFind all posts by dmitriSend private messageVisit poster's website
Array in Struct
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