org.apache.axiom.om.util.AXIOMUtil.stringToOM()方法的使用及代码示例

x33g5p2x  于11个月前 转载在 其他  
字(11.1k)|赞(0)|评价(0)|浏览(39)

本文整理了Java中org.apache.axiom.om.util.AXIOMUtil.stringToOM()方法的一些代码示例,展示了AXIOMUtil.stringToOM()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。AXIOMUtil.stringToOM()方法的具体详情如下:
包路径:org.apache.axiom.om.util.AXIOMUtil
类名称:AXIOMUtil
方法名:stringToOM

AXIOMUtil.stringToOM介绍

[英]Create an OMElement from an XML fragment given as a string.
[中]从作为字符串给定的XML片段创建OmeElement。

代码示例

代码示例来源:origin: org.apache.synapse/synapse-core

/**
   * 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;
    }
  }
}

代码示例来源:origin: org.apache.ws.commons.axiom/axiom-api

/**
 * 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);
}

代码示例来源:origin: org.apache.synapse/synapse-core

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;
}

代码示例来源:origin: wmixvideo/nfe

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;
}

代码示例来源:origin: wmixvideo/nfe

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;
}

代码示例来源:origin: wmixvideo/nfe

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);
}

代码示例来源:origin: wmixvideo/nfe

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);
}

代码示例来源:origin: wmixvideo/nfe

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());
}

代码示例来源:origin: wmixvideo/nfe

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());
}

代码示例来源:origin: wmixvideo/nfe

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());
}

代码示例来源:origin: wmixvideo/nfe

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());
}

代码示例来源:origin: wmixvideo/nfe

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());
}

代码示例来源:origin: wmixvideo/nfe

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());
}

代码示例来源:origin: wmixvideo/nfe

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());
}

代码示例来源:origin: wmixvideo/nfe

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());
}

代码示例来源:origin: wmixvideo/nfe

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());
}

代码示例来源:origin: wmixvideo/nfe

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());
}

代码示例来源:origin: wmixvideo/nfe

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());
}

代码示例来源:origin: wmixvideo/nfe

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;
}

代码示例来源:origin: wmixvideo/nfe

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());
}

相关文章

最新文章

更多

AXIOMUtil类方法