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

br.com.swconsultoria.mdfe.util.WebServiceMdfeUtil Maven / Gradle / Ivy

The newest version!
/**
 *
 */
package br.com.swconsultoria.mdfe.util;

import br.com.swconsultoria.mdfe.dom.ConfiguracoesMDFeInterface;
import br.com.swconsultoria.mdfe.exception.MdfeException;
import org.ini4j.Wini;

import java.io.IOException;
import java.io.InputStream;

/**
 * @author Samuel Oliveira
 */
public class WebServiceMdfeUtil {

    public static String getUrl(ConfiguracoesMDFeInterface config, String tipo, String servico) throws MdfeException {

        try {

            InputStream is = WebServiceMdfeUtil.class.getResourceAsStream("/WebServicesMdfe.ini");
            Wini ini = new Wini(is);
            String secao = tipo + "_" + (config.getAmbiente().equals(ConstantesMDFe.AMBIENTE.HOMOLOGACAO) ? "H" : "P");
            String url = ini.get(secao, servico);

            if (config.isLog()) {
                System.out.println("Versão Mdfe: " + ConstantesMDFe.VERSAO.V3_00 + " - WebService: " + url);
            }
            return url;

        } catch (IOException e) {
            throw new MdfeException(e.getMessage());
        }

    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy