All Downloads are FREE. Search and download functionalities are using the official Maven repository.

br.ufsc.bridge.mpiclient.messages.PDQResponseMessage Maven / Gradle / Ivy

Go to download

Implementação de client para um servidor MPI (Master Patient Index) utilizando mensagens SOAP (PIX/PDQ) baseadas na especificação técnica para integração do DATASUS.

The newest version!
package br.ufsc.bridge.mpiclient.messages;

import java.io.IOException;
import java.io.InputStream;
import java.util.List;

import javax.xml.XMLConstants;

import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import org.xml.sax.XMLReader;
import org.xml.sax.helpers.XMLReaderFactory;

import br.ufsc.bridge.mpiclient.exceptions.MPIXmlParseException;
import br.ufsc.bridge.mpiclient.model.Cidadao;
import br.ufsc.bridge.mpiclient.responsehandler.pdq.PDQResponseMessageHandler;

/**
 * PRPA_IN201306UV02
 */
public class PDQResponseMessage {

	public List read(InputStream xmlStream) throws MPIXmlParseException {
		try {
			XMLReader xmlReader = XMLReaderFactory.createXMLReader();
			xmlReader.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true);
			PDQResponseMessageHandler handler = new PDQResponseMessageHandler(xmlReader);
			xmlReader.setContentHandler(handler);
			xmlReader.parse(new InputSource(xmlStream));

			return handler.getCidadaos();
		} catch (SAXException | IOException e) {
			throw new MPIXmlParseException("Erro ao ler resposta.", e);
		}
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy