SOAP Response: return a sequence of complex types
| From: | Punit Gupta | Date: | Fri, 22 Jun 2007 12:55:16 +0000 |
| Subject: | SOAP Response: return a sequence of complex types | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-27538@lists.php.net to get a copy of this message | ||
Hi guys,
I have spent days and days trying to figure this out. It would be awesome if someone can point me to
the right direction for this:
Basically I would like to have the WSDL defined such that one of the Elements in the response soap
is a sequence of complex type defined "Note" defined below. Following is the PHP code
which I am using to build the WSDL.
$this->__dispatch_map['GetOrderStatus'] = array('in' =>
array('UserName'=>'String', 'Password'=>'String',
'CTN'=>'Integer'), 'out' =>
array('ResultID'=>'Integer', 'ErrorString'=> 'String',
'OrderStatus' => 'String' , 'OrderTypeId' => 'String',
'CustRef' => 'String', 'EndUserRef' => 'String',
'Appointments' => "{urn:ESP}Appointments", "Notes" =>
"{urn:ESP}Notes"));
$this->__typedef['Note'] = array('PostDate' => 'Date',
'Body' => 'String', 'PostedBy' => 'String');
$this->__typedef['Notes'] =
array(array("Notes"=>"{urn:ESP}Note"));
When I look at the WSDL, it shows up like:
<complexType name="Note">
<all>
<element name="PostDate" type="xsd:Date"/>
<element name="Body" type="xsd:String"/>
<element name="PostedBy" type="xsd:String"/>
</all>
</complexType>
<complexType name="Notes">
<complexContent>
<restriction base="SOAP-ENC:Array">
<attribute ref="SOAP-ENC:arrayType" wsdl:arrayType="tns:Note[]"/>
</restriction>
</complexContent>
</complexType>
In the function implementation, I am building an associative array which looks like following:
[notes] => Array
(
[0] => Array
(
[PostDate] => Jun 19 2007 10:49AM
[Body] => Test Note 1
[PostedBy] => Punit Gupta
)
[1] => Array
(
[PostDate] => Jun 19 2007 10:56AM
[Body] => Test Note 1
[PostedBy] => Punit Gupta
)
[2] => Array
(
[PostDate] => Jun 19 2007 11:06AM
[Body] => Test note 3
[PostedBy] => Punit Gupta
)
)
However, the SOAP response xml removes all the Tag names and replaces them with integer indexes. I
really need to be able to retain those Tag names (PostDate, Body, PostedBy). Any help would be
appreciated.
Thanks so much.
Punit Gupta.