If you wish to return custom XML, simply return a
DOMDocument, DOMElement or
SimpleXMLElement object.
Example 685. Return Custom XML
<?php
/**
* Say Hello
*
* @param string $who
* @param string $when
* @return SimpleXMLElement
*/
function sayHello($who, $when)
{
$xml ='<?xml version="1.0" encoding="ISO-8859-1"?>
<mysite>
<value>Hey $who! Hope you\'re having a good $when</value>
<code>200</code>
</mysite>';
$xml = simplexml_load_string($xml);
return $xml;
}
$server = new Zend_Rest_Server();
$server->addFunction('sayHello');
$server->handle();
The response from the service will be returned without modification to the client.




