/** * If the input string is valid xml, this method will convert it into an OMElement and * return back. Otherwise returns null. */ public static OMElement getOMFromXML(String text) { try { return AXIOMUtil.stringToOM(text); } catch (Exception ignore) { return null; } } }
/** * Create an OMElement from an XML fragment given as a string. * * @param xmlFragment the well-formed XML fragment * @return The OMElement created out of the string XML fragment. * @throws XMLStreamException */ public static OMElement stringToOM(String xmlFragment) throws XMLStreamException { return stringToOM(OMAbstractFactory.getOMFactory(), xmlFragment); }
public static OMElement stringToOM(String xml) { try { return AXIOMUtil.stringToOM(xml); // Just wrap to add logging for any errors } catch (XMLStreamException e) { handleException("Unable to convert a string to OM Node as the string " + "is malformed , String : " + xml, e); } return null; }
public CTeNotaConsultaRetorno consultaNota(final String chaveDeAcesso) throws Exception { final OMElement omElementConsulta = AXIOMUtil.stringToOM(this.gerarDadosConsulta(chaveDeAcesso).toString()); WSNotaConsulta.LOGGER.debug(omElementConsulta.toString()); final OMElement omElementRetorno = this.efetuaConsulta(omElementConsulta, chaveDeAcesso); WSNotaConsulta.LOGGER.debug(omElementRetorno.toString()); final CTeNotaConsultaRetorno retorno = new DFPersister().read(CTeNotaConsultaRetorno.class, omElementRetorno.toString()); WSNotaConsulta.LOGGER.info(retorno.toString()); return retorno; }
public MDFeNotaConsultaRetorno consultaNota(final String chaveDeAcesso) throws Exception { final OMElement omElementConsulta = AXIOMUtil.stringToOM(this.gerarDadosConsulta(chaveDeAcesso).toString()); WSNotaConsulta.LOGGER.debug(omElementConsulta.toString()); final OMElement omElementRetorno = this.efetuaConsulta(omElementConsulta, chaveDeAcesso); WSNotaConsulta.LOGGER.debug(omElementRetorno.toString()); final MDFeNotaConsultaRetorno retorno = new DFPersister().read(MDFeNotaConsultaRetorno.class, omElementRetorno.toString()); WSNotaConsulta.LOGGER.info(retorno.toString()); return retorno; }
NFRetornoConsultaCadastro consultaCadastro(final String cnpj, final DFUnidadeFederativa uf) throws Exception { final NFConsultaCadastro dadosConsulta = this.getDadosConsulta(cnpj, uf); final String xmlConsulta = dadosConsulta.toString(); WSConsultaCadastro.LOG.debug(xmlConsulta); final OMElement omElementConsulta = AXIOMUtil.stringToOM(xmlConsulta); final OMElement resultado = this.efetuaConsulta(uf, omElementConsulta); final String retornoConsulta = resultado.toString(); WSConsultaCadastro.LOG.debug(retornoConsulta); return new Persister(new DFRegistryMatcher(), new Format(0)).read(NFRetornoConsultaCadastro.class, retornoConsulta); }
NFRetornoConsultaCadastro consultaCadastro(final String cnpj, final DFUnidadeFederativa uf) throws Exception { final NFConsultaCadastro dadosConsulta = this.getDadosConsulta(cnpj, uf); final String xmlConsulta = dadosConsulta.toString(); WSConsultaCadastro.LOG.debug(xmlConsulta); final OMElement omElementConsulta = AXIOMUtil.stringToOM(xmlConsulta); final OMElement resultado = this.efetuaConsulta(uf, omElementConsulta); final String retornoConsulta = resultado.toString(); WSConsultaCadastro.LOG.debug(retornoConsulta); return new Persister(new DFRegistryMatcher(), new Format(0)).read(NFRetornoConsultaCadastro.class, retornoConsulta); }
NFLoteConsultaRetorno consultaLote(final String numeroRecibo, final DFModelo modelo) throws Exception { final OMElement omElementConsulta = AXIOMUtil.stringToOM(this.gerarDadosConsulta(numeroRecibo).toString()); WSLoteConsulta.LOGGER.debug(omElementConsulta.toString()); final OMElement omElementResult = this.efetuaConsulta(omElementConsulta, modelo); WSLoteConsulta.LOGGER.debug(omElementResult.toString()); return new Persister(new DFRegistryMatcher(), new Format(0)).read(NFLoteConsultaRetorno.class, omElementResult.toString()); }
CTeConsStatServRet consultaStatus(final DFUnidadeFederativa uf) throws Exception { final OMElement omElementConsulta = AXIOMUtil.stringToOM(this.gerarDadosConsulta(uf).toString()); WSStatusConsulta.LOGGER.info(omElementConsulta.toString()); final OMElement omElementResult = this.efetuaConsultaStatus(omElementConsulta, uf); WSStatusConsulta.LOGGER.info(omElementResult.toString()); return new Persister(new DFRegistryMatcher(), new Format(0)).read(CTeConsStatServRet.class, omElementResult.toString()); }
MDFeConsultaReciboRetorno consultaRecibo(final String numeroRecibo) throws Exception { final OMElement omElementConsulta = AXIOMUtil.stringToOM(this.gerarDadosConsulta(numeroRecibo).toString()); WSConsultaRecibo.LOGGER.info(omElementConsulta.toString()); final OMElement omElementResult = this.efetuaConsultaRecibo(omElementConsulta); WSConsultaRecibo.LOGGER.info(omElementResult.toString()); return new Persister(new DFRegistryMatcher(), new Format(0)).read(MDFeConsultaReciboRetorno.class, omElementResult.toString()); }
NFLoteConsultaRetorno consultaLote(final String numeroRecibo, final DFModelo modelo) throws Exception { final OMElement omElementConsulta = AXIOMUtil.stringToOM(this.gerarDadosConsulta(numeroRecibo).toString()); WSLoteConsulta.LOGGER.debug(omElementConsulta.toString()); final OMElement omElementResult = this.efetuaConsulta(omElementConsulta, modelo); WSLoteConsulta.LOGGER.debug(omElementResult.toString()); return new Persister(new DFRegistryMatcher(), new Format(0)).read(NFLoteConsultaRetorno.class, omElementResult.toString()); }
NFStatusServicoConsultaRetorno consultaStatus(final DFUnidadeFederativa uf, final DFModelo modelo) throws Exception { final OMElement omElementConsulta = AXIOMUtil.stringToOM(this.gerarDadosConsulta(uf).toString()); WSStatusConsulta.LOGGER.debug(omElementConsulta.toString()); final OMElement omElementResult = this.efetuaConsultaStatus(omElementConsulta, uf, modelo); WSStatusConsulta.LOGGER.debug(omElementResult.toString()); return new Persister(new DFRegistryMatcher(), new Format(0)).read(NFStatusServicoConsultaRetorno.class, omElementResult.toString()); }
CTeConsultaRecLoteRet consultaLote(final String numeroRecibo) throws Exception { final OMElement omElementConsulta = AXIOMUtil.stringToOM(this.gerarDadosConsulta(numeroRecibo).toString()); WSRecepcaoLoteRetorno.LOGGER.info(omElementConsulta.toString()); final OMElement omElementResult = this.efetuaConsulta(omElementConsulta); WSRecepcaoLoteRetorno.LOGGER.info(omElementResult.toString()); return new Persister(new DFRegistryMatcher(), new Format(0)).read(CTeConsultaRecLoteRet.class, omElementResult.toString()); }
MDFeConsultaNaoEncerradosRetorno consultaNaoEncerrados(final String cnpj) throws Exception { final OMElement omElementConsulta = AXIOMUtil.stringToOM(this.gerarDadosConsulta(cnpj).toString()); WSConsultaNaoEncerrados.LOGGER.info(omElementConsulta.toString()); final OMElement omElementResult = this.efetuaConsultaStatus(omElementConsulta); WSConsultaNaoEncerrados.LOGGER.info(omElementResult.toString()); return new Persister(new DFRegistryMatcher(), new Format(0)).read(MDFeConsultaNaoEncerradosRetorno.class, omElementResult.toString()); }
NFDownloadNFeRetorno downloadNota(final String cnpj, final String chave) throws Exception { final OMElement omElementConsulta = AXIOMUtil.stringToOM(this.gerarDadosDownloadNF(cnpj, chave).toString()); WSNotaDownload.LOGGER.debug(omElementConsulta.toString()); final OMElement omElementRetorno = this.efetuaDownloadNF(omElementConsulta); WSNotaDownload.LOGGER.debug(omElementRetorno.toString()); return new Persister(new DFRegistryMatcher(), new Format(0)).read(NFDownloadNFeRetorno.class, omElementRetorno.toString()); }
NFNotaConsultaRetorno consultaNota(final String chaveDeAcesso) throws Exception { final OMElement omElementConsulta = AXIOMUtil.stringToOM(this.gerarDadosConsulta(chaveDeAcesso).toString()); WSNotaConsulta.LOGGER.debug(omElementConsulta.toString()); final OMElement omElementRetorno = this.efetuaConsulta(omElementConsulta, chaveDeAcesso); WSNotaConsulta.LOGGER.debug(omElementRetorno.toString()); return new Persister(new DFRegistryMatcher(), new Format(0)).read(NFNotaConsultaRetorno.class, omElementRetorno.toString()); }
MDFeConsStatServRet consultaStatus(final DFUnidadeFederativa uf) throws Exception { final OMElement omElementConsulta = AXIOMUtil.stringToOM(this.gerarDadosConsulta(uf).toString()); WSStatusConsulta.LOGGER.info(omElementConsulta.toString()); final OMElement omElementResult = this.efetuaConsultaStatus(omElementConsulta, uf); WSStatusConsulta.LOGGER.info(omElementResult.toString()); return new Persister(new DFRegistryMatcher(), new Format(0)).read(MDFeConsStatServRet.class, omElementResult.toString()); }
NFNotaConsultaRetorno consultaNota(final String chaveDeAcesso) throws Exception { final OMElement omElementConsulta = AXIOMUtil.stringToOM(this.gerarDadosConsulta(chaveDeAcesso).toString()); WSNotaConsulta.LOGGER.debug(omElementConsulta.toString()); final OMElement omElementRetorno = this.efetuaConsulta(omElementConsulta, chaveDeAcesso); WSNotaConsulta.LOGGER.debug(omElementRetorno.toString()); return new Persister(new DFRegistryMatcher(), new Format(0)).read(NFNotaConsultaRetorno.class, omElementRetorno.toString()); }
private OMElement efetuaInutilizacao(final String inutilizacaoXMLAssinado, final DFModelo modelo) throws Exception { final NFeInutilizacao4Stub.NfeDadosMsg dados = new NFeInutilizacao4Stub.NfeDadosMsg(); final OMElement omElement = AXIOMUtil.stringToOM(inutilizacaoXMLAssinado); WSInutilizacao.LOGGER.debug(omElement.toString()); dados.setExtraElement(omElement); final NFAutorizador400 autorizador = NFAutorizador400.valueOfCodigoUF(this.config.getCUF()); final String urlWebService = DFModelo.NFE.equals(modelo) ? autorizador.getNfeInutilizacao(this.config.getAmbiente()) : autorizador.getNfceInutilizacao(this.config.getAmbiente()); final NfeResultMsg nf4Result = new NFeInutilizacao4Stub(urlWebService).nfeInutilizacaoNF(dados); final OMElement dadosRetorno = nf4Result.getExtraElement(); WSInutilizacao.LOGGER.debug(dadosRetorno.toString()); return dadosRetorno; }
NFStatusServicoConsultaRetorno consultaStatus(final DFUnidadeFederativa uf, final DFModelo modelo) throws Exception { final OMElement omElementConsulta = AXIOMUtil.stringToOM(this.gerarDadosConsulta(uf).toString()); WSStatusConsulta.LOGGER.debug(omElementConsulta.toString()); final boolean consultaNotaBahiaWorkaround = DFUnidadeFederativa.BA.equals(uf) && DFModelo.NFE.equals(modelo); final OMElement omElementResult = consultaNotaBahiaWorkaround ? this.efetuaConsultaStatusBahia(omElementConsulta) : this.efetuaConsultaStatus(omElementConsulta, uf, modelo); WSStatusConsulta.LOGGER.debug(omElementResult.toString()); return new Persister(new DFRegistryMatcher(), new Format(0)).read(NFStatusServicoConsultaRetorno.class, omElementResult.toString()); }