public function parseResponse($response, $code = 4)
    {
        $domResponse = new DOMDocument();
        $domResponse->loadXML($response);

        if ($code === 200 || $code == 0) {
            return $response;
        } else {
            $errorCode = $domResponse->getElementsByTagName('SifraGreske')->item(0);
            $errorMessage = $domResponse->getElementsByTagName('PorukaGreske')->item(0);
            $faultCode = $domResponse->getElementsByTagName('faultcode')->item(0);
            $faultMessage = $domResponse->getElementsByTagName('faultstring')->item(0);

            if ($errorCode && $errorMessage) {
                throw new Exception(sprintf('[%s] %s', $errorCode->nodeValue, $errorMessage->nodeValue));
            } else {
                if ($faultCode && $faultMessage) {
                    throw new Exception(sprintf('[%s] %s', $faultCode->nodeValue, $faultMessage->nodeValue));
                } else {
                    throw new Exception(print_r($response, true), $code);
                }
            }
        }
    }