Ejemplo n.º 1
0
 public static function generateUUIDasOID()
 {
     $uuid = iHRIS_UUID_Map::generateUUID();
     return '2.25.' . self::bchexdec(strtr($uuid, '-', ''));
 }
    protected function action_full_soap($last_modified = -1, $cache_names = false, $headers = false, $content = false)
    {
        if (!$content) {
            $content = file_get_contents("php://input");
        }
        $content = file_get_contents("php://input");
        if (!$content || !($req_doc = new DOMDocument("1.0", "UTF-8")) || !$req_doc->loadXML($content) || !($xpath = new DOMXPath($req_doc)) || !$xpath->registerNamespace('soap', 'http://www.w3.org/2003/05/soap-envelope') || !$xpath->registerNamespace('wsa', 'http://www.w3.org/2005/08/addressing') || !$xpath->registerNamespace('csd', 'urn:ihe:iti:csd:2013') || !($results = $xpath->query('/soap:Envelope/soap:Body/csd:getModificationsRequest/csd:lastModified')) instanceof DOMNodeList || !($results->length == 1) || !($item = $results->item(0)) instanceof DOMElement || !($mod_time = $item->textContent) || !($results = $xpath->query('/soap:Envelope/soap:Header/wsa:MessageID')) instanceof DOMNodeList || !($results->length == 1) || !($item = $results->item(0)) instanceof DOMElement || !($msg_id = $item->textContent)) {
            I2CE::raiseError("Invalid request");
            //NEED TO ADD IN ERROR HANDLING ACCORDING TO SPEC
            return false;
        }
        if ($errors = I2CE_Dumper::cleanlyEndOutputBuffers()) {
            I2CE::raiseError("Got errors:\n{$errors}");
        }
        if (!is_array($headers)) {
            $headers = array('Content-Type: text/xml');
        }
        foreach ($headers as $header) {
            header($header);
        }
        echo '<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:wsa="http://www.w3.org/2005/08/addressing" xmlns:csd="urn:ihe:iti:csd:2013"> <soap:Header>
            <wsa:Action soap:mustUnderstand="1" >urn:ihe:iti:csd:2013:GetDirectoryModificationsResponse</wsa:Action>
            <wsa:MessageID>urn:uuid:' . iHRIS_UUID_Map::generateUUID() . '</wsa:MessageID>
            <wsa:To soap:mustUnderstand="1"> http://www.w3.org/2005/08/addressing/anonymous</wsa:To> <wsa:RelatesTo>' . $msg_id . '</wsa:RelatesTo>
            </soap:Header>
            <soap:Body>
            <csd:getModificationsResponse>
';
        flush();
        $this->action_full_stream($mod_time, false, array(), false, false);
        echo '</csd:getModificationsResponse>
    </soap:Body>
</soap:Envelope>';
    }