note 84772 added to function.soap-soapserver-construct

From: Date: Tue, 29 Jul 2008 16:45:17 +0000
Subject: note 84772 added to function.soap-soapserver-construct
Groups: php.notes 
Request: Send a blank email to php-notes+get-142899@lists.php.net to get a copy of this message
Things that I've searched a lot for that might be useful to somebody: If you are using Zend Studio, you can easily generate a wsdl file using the WSDL Generator if you document your code using PHPDOC. One thing a lot of people are searching everywhere, is the way to pass/return an array of variables... In your PHPDOC block use the [] after the variable name like this class SoapServer { /** * This is My Soap Server * @param integer[] $a * @param string[] $b * @param bar[] $c */ public function foo ($a, $b, $c){ } } This way, the function will require an array of integers for $a, an array of strings for $b and an array of objets of Class "bar" for $c In the WSDL, you'll find something like this <xsd:complexType name="barArray"> <xsd:complexContent> <xsd:restriction base="soapenc:Array"> <xsd:attribute ref="soapenc:arrayType" wsdl:arrayType="typens:bar[]"/> </xsd:restriction> </xsd:complexContent> </xsd:complexType> <xsd:complexType name="bar"> <xsd:all> <xsd:element name="var1" type="xsd:boolean"/> <xsd:element name="var2" type="xsd:integer"/> <xsd:element name="var3" type="xsd:string"/> </xsd:all> </xsd:complexType> I didn't define anywhere the barArray type, Zend's WSDL Generator generated it automatically... If you are not using Zend you can generate the wsdl file manually. Hope it helps someone ---- Server IP: 66.207.199.35 Probable Submitter: 70.83.251.43 ---- Manual Page -- http://www.php.net/manual/en/function.soap-soapserver-construct.php Edit -- https://master.php.net/note/edit/84772 Del: integrated -- https://master.php.net/note/delete/84772/integrated Del: useless -- https://master.php.net/note/delete/84772/useless Del: bad code -- https://master.php.net/note/delete/84772/bad+code Del: spam -- https://master.php.net/note/delete/84772/spam Del: non-english -- https://master.php.net/note/delete/84772/non-english Del: in docs -- https://master.php.net/note/delete/84772/in+docs Del: other reasons-- https://master.php.net/note/delete/84772 Reject -- https://master.php.net/note/reject/84772 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#142899) next »