public function toXML()
    {
        $namespace = 'tns';
        $writer = new XMLWriter();
        $writer->openMemory();
        $writer->setIndent(true);
        $writer->setIndentString('    ');
        $writer->startElementNs($namespace, $this->getRequestName(), 'http://www.apis-it.hr/fin/2012/types/f73');
        $writer->writeAttribute('Id', uniqid());
        $writer->startElementNs($namespace, 'Zaglavlje', null);
        $writer->writeElementNs($namespace, 'IdPoruke', null, $this->generateUUID());
        $writer->writeElementNs($namespace, 'DatumVrijeme', null, $this->generateDateTime());
        $writer->endElement();
        $writer->writeRaw($this->getRequest()->toXML());
        $writer->endElement();

        return $writer->outputMemory();
    }