I want to return the following XML in SOAP when a function is called rather than just a string. There are many different functions that will return an xml formatted this way, is there a way that I can define what a function returns? Like making my own data type?
<meta>
<supplier>Amazon.com</supplier>
<datetime>2010/08/21 14:32:40</datetime>
</meta>
<results>
<result>
<manufacturer>Intel</manufacturer>
<itemno>8236476234</itemno>
<prices>
<price>
<quantity>10</quantity>
<cost>$1.20</cost>
</price>
<price>
<quantity>100</quantity>
<cost>$0.80</cost>
</price>
</prices>
</result>
<result> ... </result>
</results>
The best way is to put your result in an array
and then convert it to XML
. Here is a ready made script for that:
http://rssphp.net/examples/convert_array_to_xml/
It converts almost any kind of associative array to full formed XML.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.