nested object in SOAP result

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Dear all

i'm trying to retrieve an array of ElementB objects into the ElementA
element, but the array is incapsulated into a Struct object, how can i
avoid that and have directly the array result?

This is the var_dump output of my result

object(GetElementResponse)#2 (1) {
  ["Element"]=>
  object(stdClass)#3 (2) {
    ["PropertyA1"]=>
    string(4) "test"
    ["Elements"]=>
    object(stdClass)#4 (1) {
      ["Struct"]=>
      array(2) {
        [0]=>
        object(stdClass)#5 (1) {
          ["PropertyB1"]=>
          string(7) "test B1"
        }
        [1]=>
        object(stdClass)#6 (1) {
          ["PropertyB1"]=>
          string(7) "test B2"
        }
      }
    }
  }
}

 this is the code on server-side:
<?php
class testelementwsserver{
	
	function __construct(){
		
	}
	
	function GetElement(){
		
		$GetElementResponse = new GetElementResponse();
		$GetElementResponse->Element = new ElementA();
		$GetElementResponse->Element->PropertyA1="test";
		
		
		$e1=new ElementB();
		$e1->PropertyB1="test B1";
		
		$e2=new ElementB();
		$e2->PropertyB1="test B2";
		
		$GetElementResponse->Element->Elements=array($e1,$e2);
		
		return $GetElementResponse;
	}
	
}

$server = new SoapServer("http://localhost/prove_php/test-ws/test.wsdl";);
$server->setClass("testelementwsserver");
$server->handle();

?>

and this is my WSDL file:

      <xsd:element name="GetElement">
        <xsd:complexType>
          <xsd:sequence>
          </xsd:sequence>
        </xsd:complexType>
      </xsd:element>

      <xsd:element name="GetElementResponse">
        <xsd:complexType>
          <xsd:sequence>
            <xsd:element name="Element" type="xsd:ElementA" />
          </xsd:sequence>
        </xsd:complexType>
      </xsd:element>

      <xsd:element name="ElementA">
      <xsd:complexType>
        <xsd:sequence>        	
          <xsd:element maxOccurs="1" minOccurs="0" name="PropertyA1"
type="xsd:string" />
          <xsd:element maxOccurs="1" minOccurs="0" name="Elements"
type="xsd:ElementB" />
        </xsd:sequence>
      </xsd:complexType>
      </xsd:element>

      <xsd:element name="ElementB">
      <xsd:complexType>
        <xsd:sequence>        	
          <xsd:element maxOccurs="1" minOccurs="0" name="PropertyB1"
type="xsd:string" />
        </xsd:sequence>
      </xsd:complexType>
      </xsd:element>

Thanks to all in advance

-- 
/*************/
nik600
http://www.kumbe.it

-- 
PHP Soap Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [PHP Users]     [Kernel Newbies]     [PHP Database]     [Yosemite]

  Powered by Linux