Published on WSO2 Oxygen Tank (http://wso2.org)

Recursive Complex Types not working

By realrunner
Created 2008-04-22 16:20

I know this is asking a lot, but I really need it!

 

I've got complex types working beautifully, but now I'd like to return a tree-like object hierarchy like such:

 

/**

* @namespace http://www.wso2.org/php

*/

class FormElement

{

    /**

     * @property int $elementId

     */

    public $elementId;

    /**

     *

     * @property string $name

     */

    public $name;

   

    /**

     * @property array of object FormElement $values

     */

    public $values;

   

    public function __construct($e,$n)

    {

        $this->elementId = $e;

        $this->name = $n;

        $this->values = array();

        foreach(range(0,5) as $i) {

            $this->values[] = new FormElement($i,"Name$i");

        }

    }

}

FormElement has a property which is an array of FormElement objects.

The WSDL generates correctly (see attached)

but when I try and call the service I get the following error:

<b>Fatal error</b>:  Call to a member function getNamedItem() on a non-object in <b>/usr/lib/php5/20060613+lfs/wsf_php/scripts/dynamic_invocation/wsf_wsdl_util.php</b> on line <b>205</b><br />

I dug in to the PHP code a little and added a back trace and found some more interesting information:

<?xml version="1.0"?>

Array

(

    [0] => Array

        (

            [file] => wsf_wsdl.php

            [line] => 314

            [function] => wsf_get_endpoint_address

            [args] => Array

                (

                    [0] => DOMDocument Object

                        (

                        )

                )

        )



    [1] => Array

        (

            [function] => wsf_wsdl_process_in_msg

            [args] => Array

                (

                    [0] => Array

                        (

                            [sig_model_string] => error creating intermediate model

                            [payload_string] => <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><getFormEchelon xmlns="http://www.wso2.org/php"><elementId>123</elementId><physId>4321</physId><message>hello World</message></getFormEchelon></soap:Body></soap:Envelope>

                            [operation_name] => getFormEchelon

                            [function_name] => getFormEchelon

                            [class_name] => FormService

                            [class_args] => Array

                                (

                                )



                        )

                )

        )

 

Has anyone tried anything like this? I am able to do this with .NET webservices just fine so I know the SOAP/WSDL protocols can handle it. Any help would be greatly appreciated.

Kudos out to the developers of wsf/php, it's by far the best implementation of SOAP for php!

 

thanks,

Mike Nelson


Source URL:
http://wso2.org/forum/thread/3510