NuSphere Forums Forum Index
NuSphere Forums
Reply to topic
example request for 'maxOccurs'=>'unbounded' in nusoap


Joined: 26 Jul 2007
Posts: 14
Reply with quote
I have been trying to find an example/tutorial on how to impliment in php the use of an unbounded element in building a nusoap server

for example:

1. here's the base element

Code:
$server->wsdl->addComplexType(
   'Screen',
   'complexType',
   'struct',
   'all',
   '',
   array(
      'ScreenNumber' => array('name' => 'ScreenNumber' , 'type'=> 'xsd:string')
   )
);


2. here is the parent element

Code:
$server->wsdl->addComplexType(
   'ScreensObject',
   'complexType',
   'struct',
   'all',
   '',
   array(
      'Screen'   => array('name' => 'Screen' , 'type'=> 'tns:Screen', 'maxOccurs'=>'unbounded')
   )
);



--------------------------------------------------------------------------------------------------------
Now, how do you actually use this? I have tried puting an array such as the following:
1. create a associative array holding the screen data that corresponds to Screen complex type shown above

Code:
$Screen = array(
   'ScreenNumber'   => $screenid
);



2. save the instance (where Screen_array is just a dummy array that is filled up w/ all the Screen data

Code:
array_push($Screen_array, $Screen);


3. use this instance

Code:
$ScreenData = array(
   'Screen' => $Screen_array
)


but I am getting an error:

Code:
Fault
Array
(
    [faultcode] => Server
    [faultactor] =>
    [faultstring] => unable to serialize result
    [detail] =>
)


Any help would be greatly appreciated.

[/code]
View user's profileFind all posts by addisonpSend private message
Re: example request for 'maxOccurs'=>'unbounded' in nusoa


Joined: 26 Jul 2007
Posts: 14
Reply with quote
Solution:

turns out maxOccurs works the same as if you create SOAP-ENC:Array

example:

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


works the same as this:

Code:
$server->wsdl->addComplexType(
   'MainObject',
   'complexType',
   'struct',
   'all',
   '',
   array(
      'DataName'      => array('name' => 'DataName'         , 'type'=> 'tns:DataName', 'maxOccurs'=>'unbounded'),
      //'DataName'         => array('name' => 'DataName'         , 'type'=> 'tns:DataName__s'), <-- commented out so you can compare
   )
);


once again hope this helps someone else
-Addison
View user's profileFind all posts by addisonpSend private message
example request for 'maxOccurs'=>'unbounded' in nusoap
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