public function writeResponse($value)
    {
        $value = new SXmlRpcValue($value);
        $xmlValue = $value->toXml();
        $xml = <<<EOD
<?xml version="1.0"?>
<methodResponse>
  <params>
    <param>
      <value>
        {$xmlValue}
      </value>
    </param>
  </params>
</methodResponse>

EOD;
        return $xml;
    }
 public function __construct($method, $args)
 {
     $this->method = $method;
     $this->args = $args;
     $this->xml = '<?xml version="1.0"?>' . "\n" . "<methodCall>\n<methodName>{$this->method}</methodName>\n<params>";
     foreach ($this->args as $arg) {
         $this->xml .= '<param><value>';
         $v = new SXmlRpcValue($arg);
         $this->xml .= $v->toXml();
         $this->xml .= "</value></param>\n";
     }
     $this->xml .= "</params>\n</methodCall>";
 }