note 52381 added to function.soap-soapserver-addfunction
| From: | NathanO | Date: | Fri, 29 Apr 2005 06:36:30 +0000 |
| Subject: | note 52381 added to function.soap-soapserver-addfunction | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-88729@lists.php.net to get a copy of this message | ||
You may be left wondering, as I was, how to return a complex type - consider the following WSDL
snippets, for a method called Login:
<xs:element name="Login">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" maxOccurs="1" name="username"
type="xs:string" />
<xs:element minOccurs="0" maxOccurs="1" name="password"
type="xs:string" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:complexType name="UserInfo">
<xs:sequence>
<xs:element minOccurs="0" maxOccurs="1" name="Id"
type="xs:string" />
<xs:element minOccurs="0" maxOccurs="1" name="Name"
type="xs:string" />
<xs:element minOccurs="0" maxOccurs="1" name="Nickname"
type="xs:string" />
<xs:element minOccurs="0" maxOccurs="1" name="Email"
type="xs:string" />
</xs:sequence>
</xs:complexType>
<xs:element name="LoginResponse">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" maxOccurs="1"
name="LoginResult" type="s0:UserInfo" />
</xs:sequence>
</xs:complexType>
</xs:element>
Here's a working Login function that I've added with add SoapServer::addFunction
function Login($username, $password)
{
return array("LoginResult", array("Id"=>1,
"Name"=>"Nathan", "Nickname"=>"Nathan",
"Email"=>"email address") );
}
The UserInfo complextype is represented by the inner array. The outer array has just one element,
"LoginResult". The LogineResponse element seems to be treated as a one-member array by
PHP.
----
Manual Page -- http://www.php.net/manual/en/function.soap-soapserver-addfunction.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+52381
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+52381&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+52381&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+52381&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+52381&report=yes&reason=useless
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+52381&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+52381&report=yes
Search -- http://master.php.net/manage/user-notes.php