Re: [SOAP] SOAP/WSDL XSD Schema Question

From: Date: Sat, 28 Aug 2004 02:27:41 +0000
Subject: Re: [SOAP] SOAP/WSDL XSD Schema Question
References: 1  Groups: php.soap 
Request: Send a blank email to php-soap+get-1603@lists.php.net to get a copy of this message
<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! >

« previous php.soap (#1603) next »