Re: [SOAP] Array in PEAR::SOAP
| From: | Shane Caraveo | Date: | Tue, 18 Jun 2002 19:24:59 +0000 |
| Subject: | Re: [SOAP] Array in PEAR::SOAP | ||
| References: | 1 | Groups: | php.soap |
| Request: | Send a blank email to php-soap+get-130@lists.php.net to get a copy of this message | ||
Luis Barrios wrote:
Hi,
I have a services with PEAR::SOAP, the response is a array of struct but I
think that the response is not correct:
<ns6:newslistResponse>
<NewsList xsi:type="SOAP-ENC:Array"
SOAP-ENC:arrayType="xsd:anyType[6]"
SOAP-ENC:offset="[0]">
There is an example in the server_round2_base.php, echoStructArray. 'news' is not in the namespace that the xsd prefix represents, so you cannot have xsd:news. You have to have your own namespace for the type. function getNewsList() { $newsList = array(); $newsItems = getYourNewsList(); if ($newsItems) { foreach($newsItems as $item) {I think that SOAP-ENC:arrayType="xsd:anyType[3]" it is not correct,maybe something like SOAP-ENC:arrayType="xsd:news[3]" and the element <news> something like: <news xsi:type="......"> but I dont know how I can change that in the server-side. Please, help me, Luis
$newsList[] = new SOAP_Value('item','{http://yournamespace/}news',$item);
}
return $newsList;
}
A namespace with be added to the envelope for http://yournamespace/, and the arrayType should end up being something like ns1:news[]
Shane