tags:

views:

1315

answers:

2

I've NuSOAP web-server: ...

    $server->register('getMembersEvents',    
        array('date' => 'xsd:string'),             
        array('Events' => 'tns:Events'),
        'urn:my',             
        false,       
        'rpc',       
        false,       
        'Description'    
    );

    $server->wsdl->addComplexType(
        'Events',
        'complexType',
        'array',
        '',
        'SOAP-ENC:Array',
        array('Event' =>array ('name' => 'Event', 'type' => 'tns:Event')),
        array(
         'Event' => array('ref'=>'SOAP-ENC:arrayType','wsdl:arrayType'=>'tns:Event[]')
        ),
        'tns:Event'
    );

$server->wsdl->addComplexType(
    'Event',
    'complexType',
    'struct',
    'all',
    '',
    array(
     'field1' => array('name' => 'MemberNumber', 'type' => 'xsd:int'),
                 // ...
     'fieldN' => array('name' => 'WebMemberID', 'type' => 'xsd:int')
    )
);

Everyting works fine, but the response seems like:

<SOAP-ENV:Body>
  <ns1:getMembersEventsResponse xmlns:ns1="urn:eliza">
         <Events xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="tns:Event[2]">
            <item xsi:type="tns:Event">
               <field1 xsi:type="xsd:int">123</field1>
                  ...
               <fieldN xsi:type="xsd:int">123</fieldN>
            </item>
            <item xsi:type="tns:Event">
               <field1 xsi:type="xsd:int">123</field1>
                  ...
               <fieldN xsi:type="xsd:int">123</fieldN>
            </item>
         </Events>
      </ns1:getMembersEventsResponse>
   </SOAP-ENV:Body>

How cab I rename "item"? I have to have Events -> Event node structure.

+1  A: 

Dear sir, I solved this problem using this

$server->wsdl->addComplexType(
'Event',
'element',
'struct',
'all',
'',
array(
    'field1' => array('name' => 'MemberNumber', 'type' => 'xsd:int'),
             // ...
    'fieldN' => array('name' => 'WebMemberID', 'type' => 'xsd:int')
));

I use "element" instead of "complexType" for the typeClass parameter.

Elhussein Hashem
A: 

Hi, I'm interested in the client-side call, could you please provide an example?

Motherhacker