note 84772 modified in function.soap-soapserver-construct by thiago
| From: | thiago@php.net | Date: | Tue, 29 Jul 2008 17:25:56 +0000 |
| Subject: | note 84772 modified in function.soap-soapserver-construct by thiago | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-142901@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
<?php
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
--was--
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
http://php.net/manual/en/function.soap-soapserver-construct.php