Re: SOAP/WSDL XSD Schema Question

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

 



<complexType name="MyObj">
  <sequence>
    <element name="objVar" type="xsd:string"/>
  </sequence>
</complexType>

<complexType name="ArrayOfMyObj">
  <complexContent>
    <restriction base="soapenc:Array">
       <attribute ref="soapenc:arrayType" wsdl:arrayType="impl:MyObj[]">
    </restriction>
  </complexContent>
</complexType>

PHP classes:

class MyObj {
  var $objVar;
  function & __to_soap() {
     $inner[] = new SOAP_Value('objVar', 'string', $this->objVar);
     return new SOAP_Value('MyObj', NAMESPACE.'MyObj', $inner); 
  }
}

class ArrayOfMyObj {
  var $objs;
  function & __to_soap() {
    foreach ($this->objs as $key => $value) {
      $inner[] = $value->__to_soap();
    }
    return new SOAP_Value('ObjArray', NAMESPACE.'ArrayOfMyObj', $inner);
  }
}

On Thu, 2004-08-26 at 15:13 +0300, Atanas Vasilev wrote:
> Hello guys,
> 
> I'm having a hard time figuring out the schema for an array of objects that 
> should be later passed to/from the web service.
> 
> --------------------
> <types>
>   <xsd:schema targetNamespace="http://example.com/example"; 
> xmlns="http://www.w3.org/2001/XMLSchema";>
>     <xsd:complexType name="Obj">
>       <xsd:element name="property1" type="xsd:String" />
>       <xsd:element name="property2" type="int" />
>       <xsd:element name="property3" type="int" />
>       <xsd:element name="property4" type="int" />
>     </xsd:complexType>
> </types>
> 
> <message name='nameOfObject'>
>   <part name='symbol' type='xsd:Obj'/>
> </message>
> --------------------------
> 
> This would be great for passing an object, but what should be the way to 
> describe an array of objects?
> 
> Thanks! 
> 

-- 
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