Advertisement

07.06.2008 at 07:41PM PDT, ID: 23542350 | Points: 500
[x]
Attachment Details

NuSOAP with PHP and complexTypes

Asked by imaginative in PHP Scripting Language, PHP and Databases, SOAP

Essentially, a print_r of my array looks like the
following now:

(
   [0] => Array
       (
           [extension] => 5364742
           [call_log] => Array
               (
                   [0] => Array
                       (
                           [date] => 2008-05-12 18:56:36
                           [caller] => 323
                       )

                   [1] => Array
                       (
                           [date] => 2008-05-13 11:25:51
                           [caller] => 718
                       )

                   [2] => Array
                       (
                           [date] => 2008-05-19 14:39:28
                           [caller] => 718
                       )

                   [3] => Array
                       (
                           [date] => 2008-05-19 19:13:05
                           [caller] => 718
                       )

               )

       )

   [1] => Array
       (
           [extension] => 6182612
           [call_log] => Array
               (
                   [0] => Array
                       (
                           [date] => 2008-05-12 18:09:03
                           [caller] => 718
                       )

                   [1] => Array
                       (
                           [date] => 2008-05-13 11:27:24
                           [caller] => 718
                       )

               )

       )

)

I then tried to define the complexTypes accordingly with NuSOAP:

$server->wsdl->addComplexType(
   'CallLog',
   'complexType',
   'struct',
   'all',
   '',
   array(
       'date' => array('name'=>'date','type'=>'xsd:string'),
       'caller' => array('name'=>'caller','type'=>'xsd:string')
   )
);

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

$server->wsdl->addComplexType(
   'Extension',
   'complexType',
   'struct',
   'all',
   '',
   array(
       'extension' => array('name'=>'extension','type'=>'xsd:string'),
       'call_log' => array('name'=>'call_log','type'=>'tns:CallLogArray')
   )
);

$server->register('getCallDetailRecords',
 array('session_id' => 'xsd:int'),
 array('return' => 'tns:Extension'),
 'urn:lock',
 'urn:lock#getCallDetailRecords',
 'rpc',
 'encoded',
 'Returns the Call Detail Records for a particular Session ID.'
);

Thinking I'm on a path to victory, I then invoke a simple client to
try and retrieve the data structure I pasted above via SOAP:

s-computer:htdocs sf$ php soap.php
object(stdClass)#2 (2) {
 ["extension"]=>
 NULL
 ["call_log"]=>
 NULL
}


Not sure where I went wrong at this point....Start Free Trial
[+][-]07.15.2008 at 06:00AM PDT, ID: 22006441

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.15.2008 at 06:02AM PDT, ID: 22006464

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11.16.2008 at 04:37AM PST, ID: 22970425

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 7-day free trial to view this Administrative Comment or ask the Experts your question.

 
 
Loading Advertisement...
20081112-EE-VQP-42 / EE_QW_2_20070628